order of constructors

Peter Barada peter@the-baradas.com
Wed Dec 3 01:16:00 GMT 2003


>> Peter Barada wrote:
>> > Is there any way to control the order of static constructors so that
>> > some that access other functions are done after those functions
>> > intializing fucntions are done?
>> 
>> The C++ front end supports an init_priority attribute.  This is 
>> documented in the manual.
>
>If you require portable C++ code, arranging that the static constructors
>that have an order dependency are in the same file will enforce an ordering.

That's all well and good in a single file, but if I have constructors
that refer to objects that an RTOS sets up(in its own libraries of
course), I *have* to make sure that the RTOS library contructors are
done before the applications constructors are done...

-- 
Peter Barada
peter@the-baradas.com



More information about the Gcc mailing list