[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dlopen(): unresolved symbols for C++ initializers
From: |
Eray Ozkural (exa) |
Subject: |
Re: dlopen(): unresolved symbols for C++ initializers |
Date: |
Fri, 29 Dec 2000 00:15:17 +0200 |
Gustavo Niemeyer wrote:
>
> Hi there!!
>
> I'm currently working on a project that dlopen()s modules
> that have static C++ objects inside (with RTLD_GLOBAL). One
> of these object's constructors tries to dlopen() another
> shared object. The shared object has references to symbols
> in its parent module. When the program is called this way
> it fails, with an "unresolved symbol" error. If we move the
> code that dlopen() outside of the static object's constructor,
> everything works.
Well. I guess I will give a boring answer here. You cannot make
any assumptions on the order of initialization of C++ static
objects across modules. So, there's no guarantee that it will
work... Only within a compilation unit, there's the guarantee
that they will be initialized in the order of initialization I
guess, but when your static C++ constructors try to get at static
objects at other modules, it will fail miserably. I've had that,
too. That's well written in Stroustroup if you may find :)
Thanks,
--
Eray (exa) Ozkural
Comp. Sci. Dept., Bilkent University, Ankara
e-mail: address@hidden
www: http://www.cs.bilkent.edu.tr/~erayo