1

我一直试图在网上搜索如何在 SketchUp 中要求 ruby​​gems,但一直无法找到具体的方法。

下面是我的插件C:\Program Files\Google\Google SketchUp 8\Plugins\gems.rb

$: << 'C:/Ruby186/lib/ruby/site_ruby/1.8'
$: << 'C:/Ruby186/lib/ruby/site_ruby/1.8/i386-msvcrt'
$: << 'C:/Ruby186/lib/ruby/site_ruby'
$: << 'C:/Ruby186/lib/ruby/1.8'
$: << 'C:/Ruby186/lib/ruby/1.8/i386-mingw32'
$: << '.'
require 'rubygems'

我收到以下错误:

Error: #<LoadError: C:/Ruby186/lib/ruby/1.8/i386-mingw32/thread.so: 127: The specified procedure could not be found.   - C:/Ruby186/lib/ruby/1.8/i386-mingw32/thread.so>
(eval):14
C:/Ruby186/lib/ruby/1.8/thread.rb:5
C:/Ruby186/lib/ruby/site_ruby/1.8/rubygems.rb:11:in `require'
C:/Ruby186/lib/ruby/site_ruby/1.8/rubygems.rb:11
(eval):14:in `require'
(eval):14

但是,thread.so 正好在C:/Ruby186/lib/ruby/1.8/i386-mingw32

C:\Ruby186\lib\ruby\1.8\i386-mingw32>ls
Win32API.so    digest.so      fcntl.so   openssl.so   sdbm.so      version.h
bigdecimal.so  dl.h           gdbm.so    racc         socket.so    win32
config.h       dl.so          iconv.so   rbconfig.rb  st.h         win32ole.so
curses.so      dlconfig.h     intern.h   re.h         stringio.so  zlib.so
dbm.so         dln.h          io         regex.h      strscan.so
defines.h      enumerator.so  missing.h  ruby.h       syck.so
digest         env.h          nkf.so     rubyio.h     thread.so
digest.h       etc.so         node.h     rubysig.h    util.h

尝试在 SketchUp Ruby 面板中进行测试:

> require 'bigdecimal'
true
> require 'curses'
true
> require 'dbm'
true
> require 'digest'
true
> require 'digest/md5'
Error: #<LoadError: C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest/md5.so: 126: The specified procedure could not be found.   - C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest/md5.so>
(eval):14
(eval):14
> require 'digest\md5'
Error: #<LoadError: C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest\md5.so: 126: The specified procedure could not be found.   - C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest\md5.so>
(eval):14
(eval):14
> require 'digest/sha1'
Error: #<LoadError: C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest/sha1.so: 126: The specified procedure could not be found.   - C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest/sha1.so>
(eval):14
(eval):14
> require 'digest\sha1'
Error: #<LoadError: C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest\sha1.so: 126: The specified procedure could not be found.   - C:/Ruby186/lib/ruby/1.8/i386-mingw32/digest\sha1.so>
(eval):14
(eval):14
> require 'digest\sha2'
true
> require 'digest/sha2'
true

2 个问题

  1. 为什么里面的文件C:/Ruby186/lib/ruby/1.8/i386-mingw32有的可以正确需要,有的不能,提示LoadError?
  2. 为什么最后两行都返回true?是否与加载问题有关?

环境

  • Windows 7的
  • 红宝石 1.8.6
  • SketchUp 8.0.14346

PS。另一个同样的问题在这里

4

0 回答 0