Hi,
I'm writing a small cross-platform C-library to do geometric calculations (because it is approx five times faster than in ruby).
It works fine, when running on Linux (Fedora 20), but fails when running on Windows 8 with Cygwin with the following error:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library 'libgeom': x▒K. (LoadError)
Could not open library 'libgeom.dll':L
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:100:in `map'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:100:in `ffi_lib'
from C:/rubytest/geom.rb:6:in `<module:Geom>'
from C:/rubytest/geom.rb:1:in `<top (required)>'
from main.rb:2:in `require_relative'
from main.rb:2:in `<main>'
So in the file geom.rb I have the following:
extend FFI::Library
ffi_lib "libgeom"
On Linux I have the file libgeom.so and on Windows I have the file libgeom.dll
I'm using 64-bit cygwin and compiling the shared library with the following command:
gcc -Wall -shared geom.c -o libgeom.dll
I'm using ruby 1.9.3
I've tried supplying a full path name to the dll, but that did not make a difference. I've tried adding the current directory to PATH, but still no luck.
The .dll library is completely self-contained, and requires no other libraries. (not even -lm).
I'm quite new to ruby, but was very happy with the immediate success on my Linux machine. Now I just need to get it working on Windows too.
Any ideas on a work-around?
Sincerely,
Michael.