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]

Global objects in shared libraries


Hi,

I'm working on a small utility which allows the dynamic loading of classes in
shared libraries at runtime (http://www.mpa-garching.mpg.de/~martin/dlc/dlc-241199.tar.gz)
without the need of calling dlsym().
This utility relies on the fact that the constructors of global objects in the shared libraries
are called when the library is opened by dlopen(). This worked fine (under Linux-ELF) with
gcc-2.95; but the current CVS version doesn't seem to call the constructors, so that my
code breaks.

I'm not sure if this can be called a bug in gcc (the C++ standard doesn't say anything about
shared libraries, AFAIK), so I'd like to hear the opinion of the experts: should global
objects in shared libraries be constructed at load time and destroyed at unload time, or
is the behaviour undefined?

If you think the behaviour of the current CVS version is wrong, I will create a full bug report.

Thanks in advance,
  Martin


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