[Top][All Lists]

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

Re: dlopen from dlopend library question

From: Gleb Natapov
Subject: Re: dlopen from dlopend library question
Date: Mon, 1 Aug 2005 17:58:03 +0300

On Mon, Aug 01, 2005 at 03:42:17PM +0200, Ralf Wildenhues wrote:
> Hi Gleb,
> Sorry for the late response,
Thank you for you response!

> * Gleb Natapov wrote on Sun, Jul 17, 2005 at 11:39:34AM CEST:
> > 
> > I have library (lets say that on startup checks available 
> > hardware and loads appropriate plugin (say to drive the hardware.
> > uses symbols from 
> > 
> > Everything works OK if linked with application, but if
> > application is modular by itself and use module (say that
> > is linked with then dlopen of from fails with
> > unresolved symbols.
> > 
> > How can I solve this issue?
> If you use Libtool/libltdl for portable modules (which you do not seem
> to do), look at Libtool branch-2-0 or CVS HEAD, which allows ltdlopen'ing
> from libraries.  Make sure to read the corresponding documentation
> pertaining to libltdl, make use of `-module' and `-export-dynamic'.
The project I saw this problem with actually use libtool (not 2.0
though). And both flags are used.

> > PS: All this happens using linux system.
> If you want to be GCC/GNU ld specific only, you can use --export-dynamic
> for exporting symbols to dlopen'ed modules.
> If this is not enough help, don't hesitate to ask for details.  If you
> could provide a small example that reproduces the failure, the better.
After investigation of the problem I found that tries to load from library constructor. Even if is dlopen with 
RTLD_GLOBAL flag set, can't resolve symbols from

Let me explain this one more time.

Program 'prog' calls dlopen(, RTLD_GLOBAL), in constructor
calls dlopen( and this call fails with unresolved symbols

If we add function init_a() to and move dlopen( from 
constructor to the function and we call this function from 'prog' after
dlopen (, RTLD_GLOBAL) then everything works as expected.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]