This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Question about __attribute__ ((construtor))
Op wo 15-10-2003, om 18:00 schreef Carlo Wood:
> On Wed, Oct 15, 2003 at 11:33:38AM +0200, Jeroen Benckhuijsen wrote:
> > My questions are:
> > (1) How is the order determined for functions defined with __attribute__
> > ((constructor)) with respect to normal variable initialization and other
> > functions defined with the same attribute?
> >
> > (2) Is it possible to change or correct this order?
>
> This is not a bug. The order is not specified and will differ between
> compiler versions, even between versions from the same source (ie, gcc).
>
> See also the FAQ at
> http://users.utu.fi/~sisasa/oasis/cppfaq/ctors.html#[10.9]
>
> and following paragraphs.
Thanx for your input, it solved a lot of problems. The behaviour I
experience now is that main() is called BEFORE all of the static
initialization is done. It this also the way static initialization is
handled? AFAIK main() isn't called till all of the static
initializations are done.
TIA
--
Jeroen Benckhuijsen <jeroen@themindconnection.com>
The Mind Connection