I'm having a problem with the order of initialization of global objects
within my project. All my source is in C++ and I'm using Xcode 2.2.
I have a class which defines only static members and methods. All the
declarations are made in the header and the definitions in the cpp
file. However at execution time, it turns out that one of the static
methods is called before the static members have been initialized. Is
there a way I can force the class members to be initialized before it
is used by other global objects? I tried reordering the Compile
Sources, but it did not have any effect.
I hope I'm asking the right question. Thanks for any help.
Steven Walker
Ben Artin - 16 Dec 2005 20:50 GMT
> I'm having a problem with the order of initialization of global objects
> within my project. All my source is in C++ and I'm using Xcode 2.2.
[quoted text clipped - 6 lines]
> is used by other global objects? I tried reordering the Compile
> Sources, but it did not have any effect.
Depending on order of static initializers is a bug in your code. You should read
Item 26 in Meyers' "More Effective STL" for ideas on how to address this
problem.
Ben

Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
steve@walkereffects.com - 16 Dec 2005 22:51 GMT