This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dlopen() does not call static constructors on HP-UX


I suppose this is an old can of worms, but after multiple searches 
through the mailing list I'm still not enlightened in my specific 
problem, so here I go.

Looks like on HP-UX 11.00,  using g++ 3.2, when I link against a shared 
library containing static objects, their constructors are called.  But 
if I do dlopen(), or shl_load() for the shared library, the static 
objects are not initialized.

Now seems like a HP-UX specific bug, and searching gnats it indeed looks 
like the same one 
as PR 8360. 
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8360

Having full control of the dlopen(), which happens in my C++ source, I'm 
looking for a way to manually circumvent this bug.  Examining my shared 
library symbols, looks like there is something called 
__static_initialization_and_destruction, which I guess arranges for the 
constructors and destructors to be called.   Is there a way I can 
arrange my code to call this function after I've done the dlopen()?

Regards,

Harri


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]