This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello! On Mon, 1 Dec 2003 21:10:26 -0500 (EST) Peter Barada <peter@the-baradas.com> wrote: PB> I guess I'm really asking is there any way to collect together a group PB> of static constructors and then have them 'constructed' *after* some PB> initialization functions for objects/libraries that they refer to have PB> been called? Perhaps, there is a way based on C++ standard to achieve what you wanted. Generally, you cannot control an execution order of static constructors in whole multi-module program, but the sequence of initialization of static variables inside one module is predefined (in declaration order). Additionally, in C++ you can use expressions in initializers and even function calls. This leads to the following solution (if I got your problem right): extern int function_to_initialize_some_library( ); // this function does required 1st step of initialization int dummy_variable = function_to_initialize_some_library( ); // we declare dummy static variable to call initializing function // in advance to the following declarations // now we can invoke constructors: 2nd step of initialization Class1 object1; Class2 object2(arg); // etc.... -- lyo+ lyo/at/mail/dot/lanck/dot/net ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |