Static Initializer

Mike Stump mrs@apple.com
Mon Oct 18 20:58:00 GMT 2004


On Oct 18, 2004, at 8:49 AM, Kartchner Val Civ OO-ALC/MASHA wrote:
> We are using the Verdix Ada compiler and GNU C++ compiler to create an
> executable.  Each language wants to have it's "main" procedure run so 
> that
> it can control startup and initialize static and global variables.  But
> there can be only one main.  I'm hoping that there is a global 
> function that
> I can call to initialize the C++ static and globals.  I have checked 
> the FAQ
> and the manuals, but I haven't found an answer to my question.

Compile an empty main on your system, and then see what it does, then, 
put that code in your code to initialize C++; or, use symbol remapping 
features of your linker to change the name main of the C++ main.o file, 
to cpp_main, and then in Ada, call cpp_main when you want; or, recode 
gcc's initialization strategy for your platform to not be so brain dead 
and join the 1980s.

The last one main in fact be the nicest long term solution...  :-)



More information about the Gcc mailing list