Subject:
Re: [ruby-ffi] Re: Multiple libraries included via dlopen()?
From:
Wayne Meissner
Date:
12/16/10 9:46 PM
To:
ruby-ffi@googlegroups.com

On 17 December 2010 11:46, mjmac <mjmac42@gmail.com> wrote:
>> By default, FFI loads libraries as :lazy, :local so symbols are not
>> exported into the global namespace.
>
> Sweet!  I hackported this from master to 0.6.3 and it works
> perfectly.  I'm still prototyping so this is a workable solution for
> now.

You probably don't need to backport all the machinery in ffi_lib_flags
and ffi_lib, you can might get away with using something like:

GlobalSlurm = DynamicLibrary.open(FFI.map_library_name('slurm'),
FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL)

That should re-open the library as global.  (storing it in a constant
just keeps the library handle alive, and hence from being closed when
GC is performed).