Constructor called twice on global objects

Barry Haddow bhaddow@orbism.com
Mon Sep 27 07:49:00 GMT 1999


RedHat Linux 6.0 (kernel 2.2.10)
ld version 2.91
egcs version 2.95.1

Hi

I have the same global object in two different source files. One source
file is compiled and linked into a shared
object and the other is compiled and linked into the executable, the
executable being linked with the
shared object. I find that only one instance of the global object is
created, but its constructor and destructor are called twice.
Surely this can't be correct? - I don't observer this behaviour on other
UNIX platforms.

I have attached a simple testcase which illustrates the problem.


thanks

Barry




More information about the Binutils mailing list