Subject:
[ruby-ffi] Multiple libraries included via dlopen()?
From:
Michael MacDonald
Date:
12/16/10 1:01 PM
To:
ruby-ffi@googlegroups.com

Hi.

I'm trying to use ruby-ffi for a library which uses plugins to include functionality (e.g. auth, accounting, etc.).  These plugins are loaded at runtime using dlopen.

The issue that I have is that the symbols in the main library seem to go out of scope when any of the plugin libraries are opened...  At least, this is my novice assessment of the problem.

I can load the main library, and any functions I call which don't trigger plugin loading work OK.  As soon as I call a function which triggers loading of any plugins, I get symbol lookup errors (from the plugin) for symbols which are definitely present in the main library.

e.g. 
./test.rb 
ruby: symbol lookup error: /usr/lib64/slurm/auth_none.so: undefined symbol: slurm_verbose

nm /usr/lib64/libslurm.so | grep slurm_verbose
0000000000043490 T slurm_verbose

What gives?  I'd be happy to gist code snippets if that helps to illustrate the problem, but I thought folks with more experience might recognize this right away.

Oh, I'm using ruby 1.8.6 + ruby-ffi 0.8.3.  I'd prefer not to use 1.9.2 yet if I don't have to.

Thanks!