tags:

views:

21

answers:

1

I built a (very simple) library, which I can call just fine from another C++ program.

But it won't work when I try to get Ruby FFI to link it. It gives FFI::NotFoundError, says it can't find the function exported in the DLL.

Where might things have gone wrong? Do I need special treatment when I compile my DLL using g++? I am just building it with g++ -shared -o lib.dll libsrc.cpp.

I am pretty new to Ruby, but sample code for FFI is very straightforward, and I also have code which does some pretty complex things from the user32 DLL thru FFI. So I know it works.

One more thing I can think of trying is compiling my code using visual studio in hopes of making a more "compatible" DLL, but I want to stick to GCC.

A: 

http://github.com/remogatto/ffi-inliner might help.

Note that you need to make sure that you call your methods as stdcall if they are defined that way.

http://groups.google.com/group/ruby-ffi/browse_thread/thread/e2df39cdfe96a3c7?fwc=1

You could also post your problem to the ruby ffi google group.

rogerdpack
I can't get it working. Will just make a regular Ruby extension. Thanks.
Steven Lu