Liz_Huang
(Liz Huang)
July 14, 2014, 3:32pm
1
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
Liz_Huang
(Liz Huang)
July 14, 2014, 4:09pm
2
I am using Ruby 2.1.0 and Rails 4.1.2 now, and ‘dl’ no longer works?
Liz
11155
(-- --)
July 14, 2014, 7:15pm
3
That's a very short error message. What did the rest of the error say?
Liz_Huang
(Liz Huang)
July 14, 2014, 7:49pm
4
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
Liz_Huang
(Liz Huang)
July 15, 2014, 7:55pm
6
Thanks! I will check fiddle out and post if I have any questions. It can call .dylib?
Liz
Liz_Huang
(Liz Huang)
August 4, 2014, 3:01pm
7
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
Liz_Huang
(Liz Huang)
August 4, 2014, 5:19pm
8
Does fiddle work in Mac? I saw some comment that it doesn’t work in all platforms.
Liying