Re: [linux-audio-dev] dynamic linking

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] dynamic linking
From: Martijn Sipkema (msipkema_AT_sipkema-digital.com)
Date: Wed Apr 24 2002 - 14:02:52 EEST


> >> I link with "ld -shared -Bsymbolic -lc -lm -o $@", but YMMV.
> > I did that, but when linking with the alsa library from within the
plugin,
> > alsa only works when I load the plugin with RTLD_GLOBAL, and I would
> > like to know why.
>
> If you don't specify RTLD_GLOBAL when loading your plugin, the libasound
> symbols are not made globally available to other dl_open()'ed modules.
> Specifically, they are not available to routines dynamically loaded by
> libasound (in snd_pcm_open()). Thus, loading your plugin succeeds, but
> libasound fails to load its own plugins.

ah, I think I get it. When loading a library with dlopen() from within a
library
loaded with dlopen() it can only use symbols from that library if the first
one
is loaded with RTLD_GLOBAL.

Then my question is, wouldn't it be possible for the ALSA library to not use
global symbols from its dynamically loaded libraries? That would make
loading
from a library loaded with RTLD_LOCAL possible right?

I guess it is not really a problem to have my plugin loaded with RTLD_GLOBAL
though.

--martijn


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Apr 24 2002 - 13:04:05 EEST