I have a static library with the following code:
h file:
class Foo
{
public:
Foo()
{
a = 4;
}
int a;
};
class Bar
{
public:
static const Foo foo;
};
cpp file:
const Bar::foo = Foo();
My problem is that Bar::foo does not get initialized with a=4 until some time after main(). Before then a=0. I'm trying to access Bar::foo from a DLL which statically links to the library above. And my application links to that DLL but does not access Bar::foo directly. I'm using Visual Studio 2008.
Does anyone know what could be going on?