Subject: Re: Constructor for global objects in shared lib not getting called
To: Dave Huang <email@example.com>
From: Guenther Grau <Guenther.Grau@bk.bosch.de>
Date: 12/07/1998 20:04:30
Dave Huang wrote:
> I'm running -current on an i386, with egcs as the compiler, although I
> haven't tried this with gcc--it may have the same problem.
> Suppose I have a class MyClass... if I create an instance of MyClass by
> doing "MyClass c;" at the outermost level of my program (i.e. not in a
> function), MyClass's constructor gets called when the program starts...
> Now, if I take the definition of MyClass and the "MyClass c;" and put
> them into a shared library, the global instance of MyClass still gets
> created, but its constructor is never called. It's supposed to get
> called, right? The latest Mozilla thinks so...
What version of egcs are you using? IIRC, there have been a couple
of bug fixes in egcs-1.1.1 which might affect this. Could you try
the latest egcs and report again, if you are not already using it?