• Advertisement
Sign in to follow this  

Global object initialization order

This topic is 4011 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
Advertisement
Scratch the first post. I was able to solve this by initializing the c-runtime library myself and calling our initialization code before the function call _cinit()

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement