Twigg
November 16th, 2005, 02:40 PM
I'm wrapping a C++ library into a managed C++ dll.
What I'm finding is that non of the constructors for my global\static classes or structures are getting called. The constructors get called fine when I create the items locally or new them off the heap, but in the example below the contructor never gets called.
struct testclass
{
int i;
testclass()
{
i=1;
}
};
testclass MyTestClass;
void SomeFuntion()
{
MyTestClass.i += 1; //i == 1 (not 2)
testclass MyTestClass2;
MyTestClass2.i += 1; //i == 2 (perfect)
}
Does anyone now why the constructors aren't getting called for Global\Static vars?
What I'm finding is that non of the constructors for my global\static classes or structures are getting called. The constructors get called fine when I create the items locally or new them off the heap, but in the example below the contructor never gets called.
struct testclass
{
int i;
testclass()
{
i=1;
}
};
testclass MyTestClass;
void SomeFuntion()
{
MyTestClass.i += 1; //i == 1 (not 2)
testclass MyTestClass2;
MyTestClass2.i += 1; //i == 2 (perfect)
}
Does anyone now why the constructors aren't getting called for Global\Static vars?