[comp.lang.c++] Strange Constructor Problem : Any ideas?

ashley@spinifex.eecs.unsw.oz (Ashley Aitken) (06/17/91)

G'day,

I have a strange problem with C++ Global Constructors which has eluded my
desperate attempts to comprehend it for a couple of days now.

I am using Glockenspiel C++ Versions 1.2.1 (on Apollo Domains SR10.3) and 
it has been working fine until now.

I have a rather convoluted program with a number of global objects declared
outside (ie before) the main program.

	<various functions, globals and stuff>

	CLASSA object1;

	<various functions, globals and stuff>

	main() {

		cout << "Start of Main\n";

	}

The problem is that when the program runs it DOES NOT CALL THE CONSTRUCTORS
FOR THE GLOBAL OBJECTS before (or after) it starts in the main program.

I have checked the generated C code and the STI function is defined with the
constructor calls in it, and the link structure is defined, _entry() is the
first thing in the main, and everything else seems ridgy didge (ok).

What can be happening?

My impression is that something is getting screwed up (for want of a better
term) at the linking stage. Of course, I have recompiled everything, looked
for obvious mistakes (ie old files hanging around) but to no avail.

Other relevant information:

+	It has worked before just fine!
+	It seemed to stop working after I had compiled it for profiling 
	(worked ok for the profile) and then recompiled back without 
	profiling.
+	I use the +e1/+e0 virtual table specification.
+	Doesn't matter if debug information is on or off.

I would be very grateful if anyone could give me any clues on how to go
about fixing this. It has become more than a frustration.
Please e-mail me (as well, if you post a followup).

Thanks in advance,
Ashley Aitken.
ashley@spectrum.cs.unsw.oz.au

P.S. Yes we have Version 2 but I have not had the time to try and recompile 
     my code for it as yet.