Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: dlopen () question



On Sun, Apr 06, 2008 at 08:55:56PM +0200, Vincent wrote:
> Hello!
> 
> I've been unable to get a reliable info on this: when a main program 
> loads a plugin with dlopen (), and that plugin references a weak symbol 
> inside the main program, is it normal that dlopen () fails and complains 
> about not finding the weak symbol, even with the suitable flags set 
> (RTLD_GLOBAL)? I have that behavior with the svn version of scribus on 
> current.

As posted elsewhere the only symbols in the programs symbol table that
the dynamic linker uses are those needed to satisfy references in the
libraries that ld knows about - unless you pass -E to request all of them.

However it isn't a good idea to rely on symbols being resolved in
that way.  Consider, for example, what happens if your 'main program'
code is moved into a shared library, and then that library is opened
with dlopen() - it is then almost impossible to get the plugin to
reference a symbol in the library.
You really need to pass a table of valid function-pointers into the
plugin.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index