Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!rpi!dali.cs.montana.edu!caen!spool.mu.edu!munnari.oz.au!metro!usage.csd.unsw.oz.au!spinifex!ashley From: ashley@spinifex.eecs.unsw.oz (Ashley Aitken) Newsgroups: comp.lang.c++ Subject: Strange Constructor Problem : Any ideas? Keywords: c++ constructor problem Message-ID: <727@spinifex.eecs.unsw.oz> Date: 17 Jun 91 11:57:14 GMT Organization: EE & CS, Uni N.S.W., Sydney, Australia Lines: 55 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. CLASSA object1; 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.