Operating System - HP-UX
1830730 Members
2486 Online
110015 Solutions
New Discussion

Issues with shared libraries and static memebers

 
Stephen Hoare
Occasional Contributor

Issues with shared libraries and static memebers

Hi,

I have an issue with loading librarys on HPUX 11.00 and 11i, with gcc 3.2 using C++

I had an problem with the dlopen call not correctly setting up the static classes correctly. Therefore I tried

Load the Library
Get the address of _GLOBAL__DI
run that function

This does work however I have a problem with shutdown causing a seg 11 fault. The only information I can find on this issue is around 3 years old. Please could someone confirm/deny if this approach is still required or has been fixed in this version of hpux and my makefiles are incorrect
1 REPLY 1

Re: Issues with shared libraries and static memebers

I had a similar problem. I traced it back to the following cause: When loading a shared lib written in C++ dynamically from a C program, the global static members do not get initialized. The remedies I found are: Either compile the C program with the C++ compiler, call the initilization code explicitly, or not to use global static variables in your library (if you own the code).

You are probably referring to one of these remedies?

I don't think there is a OS or compiler patch for this. However maybe there is one available in the meantime.