Subject:
Re: [ruby-ffi] [Q] search paths for loading libraries
From:
Jeremy Voorhis
Date:
5/6/10 5:31 PM
To:
ruby-ffi@googlegroups.com

I've also found, on my mac, that setting LD_LIBRARY_PATH works. This isn't ideal for distributing code.

Wayne,
Is it only possible to specify complete, absolute paths to libraries for ffi_lib? An api similar to Ruby's $: would be convenient for adding directories to the load path, like FFI.load_paths << '/usr/local/lib'.

Best,

Jeremy

On Thu, May 6, 2010 at 3:26 PM, Wayne Meissner <wmeissner@gmail.com> wrote:
ffi_lib searches in the standard locations that dlopen() would look
for the library - usually /usr/lib.  For everything else, you need to
specify by absolute path.

You can specify both "search the default paths" and "use this specific
path" like so:

module FooLib
 ffi_lib [ "foo", "/usr/local/libfoo.so", "/opt/local/libfoo.dylib" ]
end

That will try to load each of the members of the array in turn, and
stop once it has loaded once successfully.



On 7 May 2010 07:35, Chuck Remes <cremes.devlist@mac.com> wrote:
> I'm working on providing a set of FFI bindings for the zeromq (zeromq.com) message queuing library. It is typically installed in /usr/local/lib.
>
> The ruby bindings that it currently has builds a C extension which it stashes in ruby/lib/ruby/site_ruby/1.9.1/ for the correct platform. Presumably FFI would find a library installed here, but I'm hoping it will also find a library stored at the traditional /usr/local/lib location. Will it? Any way to give it a hint (aside from providing an absolute path)?
>
> cr
>
>