This is the mail archive of the gcc-bugs@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]

Constructors in shared libraries on HP/UX



 Constructors of global objects in g++-made shared libraries on HP/UX
are not called if the libraries are loaded dynamically. I experience
this problem when loading C++ extensions into the Tcl language.

 The problem can be solved by using the +I option of the HP/UX linker,
which arranges for a function to be invoked upon loading the library.

 Therefore, `g++ -shared' should add `+I _GLOBAL__DI' to the linker
command line (_GLOBAL__DI is the function to call all constructors,
generated by collect2).
 Unfortunately, there seems to be no corresponding option for
destructors when unloading the shared library. Could that be
done by installing an atexit() handler?

 BTW, it would also be useful if `g++ -shared' implied the -fPIC
option, which is needed to compile the collect2-created source code.

	Frank

-- 
 + Frank Pilhofer                        fp@informatik.uni-frankfurt.de  +
 |                                      http://www.uni-frankfurt.de/~fp/ |
 +---- Life would be a very great deal less weird without you.  - DA ----+



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