06-24-2014, 09:39 PM
There is a hacky way to get around it. Makes use of static function initialisation. Create a template registerIntitalizer
Then you can declare any function as being executed on startup with
Then move the init code into functions with a static to check for init:
Code:
template<void InitFunc*()>
class registerInitializer
{
registerInitalizer()
{
InitFunc();
}
}
Code:
registerInitalizer<func> global;
Then move the init code into functions with a static to check for init:
Code:
initfunc
{
static bool initialised = false;
if (!initalised)
{
initalised = true;
// call dependent init functions
// do init
}
}