require 'dl' doesn't work

In Ruby 1.8.7 and Rails 2.3.18, I used Dl.dlopen to load intel fortran dll like the following

require ‘dl’ …

  sspath = Pathname.new( ".../lib/libsamplesize.dylib" )
  ss = DL.dlopen( sspath )
  samplesize = ss[ "samplesize_", "iiddS" ]
  session[:n], args = samplesize[ session[:nmax], session[:delta],
                      session[:conf], session[:errmsg] ]

but I got error message at line

require ‘dl’

   This error occurred while loading the following files:
dl

Thanks!
Liz

I am using Ruby 2.1.0 and Rails 4.1.2 now, and ‘dl’ no longer works?

Liz

That's a very short error message. What did the rest of the error say?

LoadError

in SamplesizeController#compute

I don’t see anything else though, let me copy the whole page:

cannot load such file – dl

Extracted source (around line #14):

12
13
14
15
16
17

def compute

require 'dl'

require 'pathname'

# if ( session[:sigma_sq] <= 0.0 )

`Rails.root: /Library/WebServer/smart`

[Application Trace](http://localhost:3000/samplesize/compute#) |
[Framework Trace](http://localhost:3000/samplesize/compute#) |
[Full Trace](http://localhost:3000/samplesize/compute#)

app/controllers/samplesize_controller.rb:14:in `compute’


This error occurred while loading the following files: dl

## Request
**Parameters**:

None

DL was deprecated in Ruby 2.0 and removed in 2.1 in favor of Fiddle. Fiddle docs:

–Matt Jones

Thanks! I will check fiddle out and post if I have any questions. It can call .dylib?

Liz

Dear Matt:

I have tried fiddle, but couldn’t make it to import functions in .dylib (Fortran dll generated by intel fortran compiler) that I could use DL to import successfully before. Any suggestions?

Thanks! Liz

Does fiddle work in Mac? I saw some comment that it doesn’t work in all platforms.

Liying