Ruby 2.0.0p0 IRB warning: "DL is deprecated, please use Fiddle"

fbonetti picture fbonetti · Mar 23, 2013 · Viewed 156.9k times · Source

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:

DL is deprecated, please use Fiddle

Note: I'm on a Windows machine.

What does this message mean?

Answer

Franco Rondini picture Franco Rondini · Mar 24, 2013

The message you received is common when you have ruby 2.0.0p0 (2013-02-24) on top of Windows.

The message "DL is deprecated, please use Fiddle" is not an error; it's only a warning.

The source is the Deprecation notice for DL introduced some time ago in dl.rb ( see revisions/37910 ).

On Windows the lib/ruby/site_ruby/2.0.0/readline.rb file still requires dl.rb so the warning message comes out when you require 'irb' ( because irb requires 'readline' ) or when anything else wants to require 'readline'.

You can open readline.rb with your favorite text editor and look up the code ( near line 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.

EDIT: For those wanting to go deeper about Fiddle vs 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 DL or Fiddle.