Sign in to follow this  
David Neubelt

Global object initialization order

Recommended Posts

David Neubelt    866
I'm trying to force a static object to be initialized before any code is executed on VC++ 8.0. On GCC you can use __attribute__ ( ( init_priority ( value ) ) to specify the order objects are initialized in. Unfortunately, I have not found an option on Microsoft's compiler. The way we are currently doing it is by collecting all the static constructors and executing them ourself. This allows us to run code before static constructors are called. Unfortunately, this method is much more complex then having a compiler intrinsic to specify the order. In addition VC8.0 is the only platform that is different currently.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this