[Top][All Lists]

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

Re: dlopen from dlopend library question

From: Ralf Wildenhues
Subject: Re: dlopen from dlopend library question
Date: Tue, 2 Aug 2005 15:44:05 +0200
User-agent: Mutt/1.4.1i

* Gleb Natapov wrote on Mon, Aug 01, 2005 at 04:58:03PM CEST:
> On Mon, Aug 01, 2005 at 03:42:17PM +0200, Ralf Wildenhues wrote:
> > * 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.

OK.  Well, for portable use of modules from within a library you should
use either branch-2-0 or HEAD.

> 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

Just so we don't misunderstand each other: what exactly do you mean by
library constructor?  Are you overwriting DT_INIT?  (If so, you are a far
way from portable shared libraries.)

> Let me explain this one more time.
> Program 'prog' calls dlopen(, RTLD_GLOBAL), in constructor
> calls dlopen( and this call fails with unresolved symbols
> from
> 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.

Best would be if you showed short reproducible code.  Not that I know
whether I could help you then.


reply via email to

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