
----- Original Message ----- From: "elpidio valdez" <elpidiovaldez6@gmail.com> To: <boost@lists.boost.org> Sent: Tuesday, September 27, 2011 8:39 PM Subject: [boost] [signals2] 'static initialisation fiasco' issues
This all works very well except that TerrainMap needs to connect to signals from its constructor. The signals are static global objects which serve to exchange data between the independent modules. Unfortunately I have fallen foul of C++ static initialisation problems. I cannot be certain that the static signal objects will be created before the modules that use them.
Maybe you could consider doing less during construction at loadtime. I usually define all static objects, during construction they only register themselves (or some initialisation functions) to some static repository. Then at runtime, before making use of those objects, everything gets initialised by calling some static function "InitializeAllTheStuff();" which inspects the repository and does what has to be done. So all objects are for sure created before you initialise. De repository is about the only object that needs to be wrapped inside a function, and it doesn't show up in the interfaces. Instead however, the initialisation function pops up in you interface and it has to be called once. IMO that's not too bad. regards Wouter