Static Initializer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Developer,

I know that the first person reading this isn't likely the person who will
know the answer to my question.  I read the online documentation, but I
couldn't find a better email address to use.  Please forward this to the
appropriate person(s) to answer this question.

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.

To give you some background, we were using the Sun Workshop C++ Compiler
before.  We're porting to a new system, so we switched C++ compilers to have
the same on both systems, GNU C++.  I programmed the C++ defensively so that
it would work when linked with Ada.  (Uninitialized global and class static
variables are always set to zeros, so I would check in my class code to see
if it was uninitialized.)  I started using the STL classes, and I'm getting
errors when combined with Ada what would normally work if C++ controls the
startup and initialization.  So I'm assuming that the statics and globals in
the STL are not being initialized properly when linked with Ada.  But since
the STL code wasn't coded defensively, it doesn't work without proper
initialization.

And no, switching to GNU Ada isn't an option.  The Ada libraries are
precompiled for use with the Ada compiler that we are using.  And like C++,
each Ada compiler does name-mangling differently.

I figure that the answer will be a simple, "Yes, here's how to do it," or
"No, it can't be done," once it gets to the right person.

Thanks for your help,

- Val -

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux