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

+1 to scoping it per-module. I had a feeling that idea was only half-baked :)

On Thu, May 6, 2010 at 3:38 PM, Wayne Meissner <wmeissner@gmail.com> wrote:
On 7 May 2010 08:31, Jeremy Voorhis <jvoorhis@gmail.com> wrote:
> 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'.

It would be fairly trivial to add ffi_library_path on a per-module
basis.  I'm not sure whether adding it globally is such a good idea -
one library can potentially screw another one over that way.

If anyone wants to hack on it, look in lib/ffi/library.rb in the
ffi_lib method.  Both ruby-ffi and JRuby use the same code for that
section, so a patch for one should apply to the other.