Ruby 2.0.0p0 IRB 警告:“不推荐使用 DL,请使用 Fiddle”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15590450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ruby 2.0.0p0 IRB warning: "DL is deprecated, please use Fiddle"
提问by fbonetti
I just uninstalled my older versions of Ruby, removed all of my gems (including Rails), and installed Ruby 2.0. In other words, a totally clean re-install. Upon starting IRB, I received this message:
我刚刚卸载了旧版本的 Ruby,删除了所有 gem(包括 Rails),并安装了 Ruby 2.0。换句话说,完全干净的重新安装。启动 IRB 后,我收到此消息:
DL is deprecated, please use Fiddle
Note: I'm on a Windows machine.
注意:我在 Windows 机器上。
What does this message mean?
这个消息是什么意思?
回答by Franco Rondini
The message you received is common when you have ruby 2.0.0p0 (2013-02-24)on top of Windows.
您收到的邮件是常见的,当你有ruby 2.0.0p0 (2013-02-24)之上的Windows。
The message "DL is deprecated, please use Fiddle" is not an error; it's only a warning.
消息“ DL is deprecated, please use Fiddle”不是错误;这只是一个警告。
The source is the Deprecation notice for DLintroduced some time ago in dl.rb( see revisions/37910).
来源是前段时间介绍的 DL 弃用通知dl.rb(参见修订/37910)。
On Windows the lib/ruby/site_ruby/2.0.0/readline.rbfile still requires dl.rbso the warning messagecomes out when you require 'irb'( because irb requires 'readline') or when anything else wants to require 'readline'.
在 Windows 上,该lib/ruby/site_ruby/2.0.0/readline.rb文件仍然需要,dl.rb因此当您(因为 irb 需要)或其他任何需要时会出现警告消息。require 'irb''readline'require 'readline'
You can open readline.rbwith your favorite text editor and look up the code ( near line 4369 ):
您可以readline.rb使用您喜欢的文本编辑器打开并查找代码(靠近第 4369 行):
if RUBY_VERSION < '1.9.1'
require 'Win32API'
else
require 'dl'
class Win32API
DLL = {}
We can always hope for an improvement to work out this deprecation in future releases of Ruby.
我们总是希望在未来的Ruby版本中进行改进以解决此弃用问题。
EDIT: For those wanting to go deeper about Fiddlevs DL, let it be said that their purpose is to dynamically link external libraries with Ruby; you can read on the ruby-doc website about DLor Fiddle.
编辑:对于那些想要更深入地了解Fiddle与DL 的人,可以说他们的目的是将外部库与 Ruby 动态链接;您可以在 ruby-doc 网站上阅读有关DL或Fiddle 的信息。
回答by Erwin Kaddy
You may want to comment out the DL is deprecated, please use Fiddlewarning at
您可能想在以下位置注释掉DL is deprecated, please use Fiddle警告
C:\Ruby200\lib\ruby.0.0\dl.rb
since it's annoying and you are not the irb/pry or some other gems code owner
因为这很烦人,而且您不是 irb/pry 或其他一些 gems 代码所有者
回答by Gaurav
I got this resolution at openshift.com.
我在openshift.com 上得到了这个解决方案。
Resolution:
解析度:
This error occurs only on Windows machine with Ruby 2.0.0 version. Until we officially support Ruby 2.0 please downgrade to Ruby 1.9.
On Windows, you can install Ruby 1.9.3 alongside 2.0. Change your %PATH% to
c:\ruby193\or whatever directory you installed to prior to installing the gem.
此错误仅发生在 Ruby 2.0.0 版本的 Windows 机器上。在我们正式支持 Ruby 2.0 之前,请降级到 Ruby 1.9。
在 Windows 上,您可以安装 Ruby 1.9.3 和 2.0。
c:\ruby193\在安装 gem 之前,将您的 %PATH% 更改为或您安装到的任何目录。
回答by Arun Atluri
The message "DL is deprecated, please use Fiddle" is not an error; it's only a warning.
Solution:
You can ignore this in 3 simple steps.
Step 1. Goto C:\RailsInstaller\Ruby2.1.0\lib\ruby\2.1.0
Step 2. Then find dl.rb and open the file with any online editors like Aptana,sublime text etc
Step 3. Comment the line 8 with '#' ie # warn "DL is deprecated, please use Fiddle" .
That's it, Thank you.
消息“不推荐使用 DL,请使用 Fiddle”不是错误;这只是一个警告。
解决方案:
您可以通过 3 个简单的步骤忽略此问题。
步骤 1. 转到 C:\RailsInstaller\Ruby2.1.0\lib\ruby\2.1.0
步骤 2. 然后找到 dl.rb 并使用任何在线编辑器(如 Aptana、sublime text 等)打开文件
步骤 3. 注释第 8 行'#' 即 # 警告“不推荐使用 DL,请使用 Fiddle”。
就是这样,谢谢。
回答by thomthom
I ran into this myself when I wanted to make a thor command under Windows.
当我想在 Windows 下执行 thor 命令时,我自己遇到了这个问题。
To avoid having that message output everytime I ran my thor application I temporarily muted warnings while loading thor:
为了避免每次运行我的 thor 应用程序时都输出该消息,我在加载 thor 时暂时静音了警告:
begin
original_verbose = $VERBOSE
$VERBOSE = nil
require "thor"
ensure
$VERBOSE = original_verbose
end
That saved me from having to edit third party source files.
这使我不必编辑第三方源文件。

