Sign in to follow this  

Global object initialization order

This topic is 3939 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

This topic is 3939 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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