Libraries and glocal constructors

Martin von Loewis martin@mira.isdn.cs.tu-berlin.de
Fri Apr 24 23:55:00 GMT 1998


> Are there any global objects in the standard library which would still
> require a global constructor/destructor which would not get initialized
> properly when linked with a non-C++ compiler?

Whether there are global objects depends on the library. On an ELF system
using GNU binutils, you can find out with

objdump --headers /usr/local/lib/libstdc++.a|grep ctor

Whether they would be initialized when linked with a non-C++ compiler
would depend on that compiler.

> Is this addressed by the standard?  

No. The standard talks about implementations of C++, not about
implementations of some other language. Furthermore, it doesn't know
the concept of a linking process, which is purely
implementation-defined (except for 'linkage', but this is an issue
different from 'lifetime').

> Is it library implementation dependent?

Definitely. Furthermore, it also depends on the compiler, the linker,
and the object file format.

Regards,
Martin



More information about the Gcc mailing list