Cross gcc Mailing List Archive

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

Re: RTEMS questions




I've gone through all this C++ in a different O/S, but some of my
experience applies, as it involved gcc.

robert@qbiosys.demon.co.uk said:
>  I had to try several linker dependancy  combinations to get the 
> rtems-ctor.cc global constructor called  before the main.cc ones.

Note by the way that the C++ [DRAFT] standard does not require any
specific ordering of static initializers in seperate compilation units.
Withing compilation units the constructors are called in order, but
compilation units may be called in any order.

If you need a specific order of initialization, the do_global_ctors()
funtion executes the initializers in order so you can write a linker
script that arranges the .ctor sections of your files in the order you
want them initialized. Not necessarily a general solution.


-- 
Steve Williams
steve@icarus.com
steve@picturel.com

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."



References:

Home | Subject Index | Thread Index