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

RTEMS/autoconf



>>>>> "joel" == joel  <joel at OARcorp.com> writes:

joel> On Mon, 15 Feb 1999, VALETTE Eric wrote:

joel> One of the things that has long bothered me is that if global constructors
joel> are run before tasking is up, then you can block with no hope of ever
joel> getting unblocked.  I am not a C++ expert but it seems that this could get
joel> you into trouble as you use more off-the-shelf reusable libraries where
joel> everything is available to a global constructor.

Well, I know initialization order is important... In Chorus, there are macros
used to define init function 

INIT_RANGE (MODULE_ID, RANGE)
INIT_FUNC(foo, MODULE, INIT_NUMBER).

it generates __A_PREFIX_EASY_TO_PARSE_(INIT_NUMBER)_foo...

And kernel is linked in two steps once with -r and uisng the .o file
a table containing the __A_PREFIX_EASY_TO_PARSE_(INIT_NUMBER)_*
is generated. Functions are then called in sequence and can be added
almost dynamically.

NB : MODULES corespond to functionnalities (TASKING, NETWORK, ...).
INIT_FUNC may add code to check the value is in the range...

About what can be done with inside static constructor : It only
requires to be defined... As initialization can be done latter if
needed...

BTW : using global constructor is error prone as you may introduce
dependencies and the C++ standart requires nothing to control
global initialization order :-( 


--  eric