In my application, there are 2 global objects. One object’s constructor it accesses the other one assuming it is already created. Fortunately my application was running correctly for some time. But due to the recent changes in cpp files and compilation order, I figured out that the global object creation order has been changed from what my application was expected.
So, My question is,
Is there a way to control the creation order of global objects. I think the same issue should be there for static objects as well. According to my tryouts I identified that the linking order or “o” files changes this. But is it correct? Isn't there a proper way of doing this?