This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Static Initializer


Val,
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.

How global initializers are run depends on your system. You could experiment by compiling a simple main procedure and examining the assembly so produced. For instance, on my i686-pc-linux-gnu system, there is nothing special in main itself. If one examines the linker map file (generated with -Wl,-Map,a.map) produced one finds things like .init .fini and crtbegin.o, __init_array_start and other related symbols and sections. You'll have to refer to your system's ABI and psABI documentation to know what those mean and do.

Your question cannot be answered without more details of your system.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]