Subject: Re: dlopen and friends [was: Re: Help me packaging whiteBOX]
From: David Laight <email@example.com>
Date: 09/08/2002 11:03:10
On Sun, Sep 08, 2002 at 11:51:08AM +0200, Julio Merino wrote:
> On Sun, 8 Sep 2002 02:53:28 +0200
> "Martin J. Laubach" <firstname.lastname@example.org> wrote:
> > | err: /usr/pkg/share/whiteBOX/plugins/libwbbgset.so: Undefined PLT symbol "lookup_widget" (reloc type = 7, symnum = 189)
> > | could not open file ..
> > Those libxxx.so are probably missing some inter-library dependency
> > recorded while building them. You need to find out where that symbol
> > "lookup_widget" is defined (probably in some other whitebox library),
> > and modify the build process so that it adds a -lthatotherlibrary
> > to the ld stage of the plugins.
> I've checked whiteBOX's sources. lookup_widget is provided in the whiteBOX
> binary itself (support.c). This binary then loads plugins using dlopen().
> My question is... do loaded shared modules have access to loader's functions?
> I mean, if plugins are loaded by the whiteBOX binary, they should be able
> to access lookup_widget, isn't it?
Yes, with a few provisos (assuming netbsd works the same as SVR4):
- the loader must not have been dlopened itself (ie it must be part
of the program or a library that was loaded when the program was
- the symbol must be in the namelist used by the dynamic linker,
this will happen if either:
a) the version of one of the libraries found by the linker had
an unresolved external to the symbol
b) specifying -E (or -export-dynamic) to ld when linking the
David Laight: email@example.com