alsalib symbol problem
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Paul Davis
Quoted 4 lines
Quoted 4 lines
you probably are calling alsa from a shared object -- try
dlopen ("libasound.so", RTLD_LAZY | RTLD_GLOBAL);
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
in your module's init function.
The need for
RTLD_GLOBALis somewhat ugly, usually one wants to load plugins withRTLD_LOCAL.the suggestion is not that *your* plugin should use
RTLD_GLOBAL, but thatRTLD_GLOBALneeds to be used when alsa-lib is linked into the address space.
Ah, I haven't tried to dlopen libasound in a plugin yet. Up to now I've linked the plugin lib with -lasound, in that case you have dlopen the plugin lib with RTLD_GLOBAL.
Quoted 5 lines
if you don't use
RTLD_GLOBAL, then the symbols in libasound are not availble for subsequently-loaded dynamically linked code.Quoted 2 lines
Is there any reason ALSA can't do something like
Quoted 8 lines
Quoted 4 lines
if (name == NULL) { Dl_info dlinfo; static int dummy; dladdr((void *) &dummy, &dlinfo); name = dlinfo.dli_fname; }perhaps because this implementation of dlopen is platform specific? the dladdr function and the dlinfo structure are not present in my version of glibc, at least not as far as i can tell.
Define _GNU_SOURCE.
Juergen
Signature · 8 lines
Juergen Kreileder, Blackdown Java-Linux Team http://www.blackdown.org/java-linux/java2-status/ ------------------------------------------------------- Sponsored by: AMD - Your access to the experts on Hammer Technology! Open Source & Linux Developers, register now for the AMD Developer Symposium. Code: EX8664 http://www.developwithamd.com/developerlab
Quoted 11 lines
Quoted 9 lines · Paul Davis
Quoted 8 lines
Quoted 5 lines
you probably are calling alsa from a shared object -- try
dlopen ("libasound.so", RTLD_LAZY | RTLD_GLOBAL);in your module's init function.
The need for
RTLD_GLOBALis somewhat ugly, usually one wants to load plugins withRTLD_LOCAL.
Quoted 7 lines
Quoted 3 lines
the suggestion is not that *your* plugin should use
RTLD_GLOBAL, but thatRTLD_GLOBALneeds to be used when alsa-lib is linked into the address space.Ah, I haven't tried to dlopen libasound in a plugin yet. Up to now I've linked the plugin lib with -lasound, in that case you have dlopen the plugin lib with
RTLD_GLOBAL.
the problem is that libasound itself calls dlopen(), and the initial (non-RTLD_GLOBAL) linkage hasn't put libasound's symbol into the global namespace. hence, libasound's own dlopen'ed code can't access libasound itself.
that's why you either either need to use RTLD_GLOBAL on the plugin lib, or make sure that libasound alone is linked with RTLD_GLOBAL.
dynamically linking code that is linked to other code that dynamically links code is, ahem, a little complex ;)
--p
-------------------------------------------------------
Sponsored by: AMD - Your access to the experts on Hammer Technology! Open Source & Linux Developers, register now for the AMD Developer Symposium. Code: EX8664 http://www.developwithamd.com/developerlab