ok here is the deal...
Say I have a module a.h / a.cpp, and
b.h / b.cpp
b.h contains
class B
{
public:
static long *b_handle;
static long *get_handle() { return b_handle; }
};
b.cpp contains
static long *B::b_handle = NULL;
Now if I have an initialization routine in a.cpp that needs b_handle:
a.cpp
void A::init()
{
create_something(B::b_handle, ... // Is b_handle possibly undefined?
create_something(B::get_handle(), ... // (same question)
...
}
I remember reading about a "hack" to make this work, something about
a function returning the static variable will ensure it is initialized...
Is this correct?