I have 2 static objects in 2 different dlls:
An object Resources (which is a singleton), and an object User. Object User in its destructor has to access object Resources.
How can I force object Resources not to be destructed before object User?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Global objects are destroyed when their corresponding DLL is unloaded. So as your ‘User’ dll is probably dependent of your ‘Resource’ dll, you are in trouble: ‘resource’ will always be destroyed before ‘user’.
I’m also interested by a good answer to this question, if one exist. Until now, I’m using a cleanup function that must be called by application before it quits, and I only keep harmless code in destructors.