//CCodeWrapperIF.h
public ref class CCodeWrapperIF
{
public:
CCodeWrapperIF// Default constructor
public:
static UINT8 funny;
void foo(void);
}
//CCodeWrapperIF.cpp
extern "C"
{
#include "CCodeWrapperIF.h"
}
[DllImport("CCode.DLL", CallingConvention = CallingConvention::Cdecl)]
extern "C" void CCode_Foo(void);
CCodeWrapperIF::CCodeWrapperIF(void)
{
}
CCodeWrapperIF::foo(void)
{
CCode_Foo();
}
//a.h
public ref class A
{
private: static CCodeWrapperIF^ CCode_IFObject;
A(void)
{
CCode_IFObject=gcnew CCodeWrapperIF();
}
}
//b.h
public ref class B
{
private: static CCodeWrapperIF^ CCode_IFObject;
B(void)
{
}
}
//main.h
int main(cli::array<System::String ^> ^args)
{
A^ aObj=gcnew A();
B^ bObj=gcnew B();
// Funny thing is : bObj->CCode_IFObject->funny has correct value always!
// while if you watch the value of bObj->CCode_IFObject acturally it is not defined!!
}
can anyone explain this?