StackOverflowException after calling unmanaged ctor

  • Thread starter Thread starter SteveK
  • Start date Start date
S

SteveK

**Newbie with managed C++**

I'm trying to wrap an unmanaged C++ class in a managed C++ class library.
When I instantiate the wrapper class it's ctor calls the ctor on the
unmanaged class and at that point I get the exception:
"An unhandled exception of type 'System.StackOverflowException' occurred in
suabwrapper.dll"

I have been able to reproduce this with an unmanaged class that is VERY
simple:
class CTest

{

public:

CTest(){ m_id = 1; }

~CTest(){}

int GetID(){ return m_id; };



private:

int m_id;

};





In my managed class I have a CTest* member that I assign to a new CTest() in
the managed class' ctor:

CSUABWrapper()

{

m_pTest = new CTest();

}









Once the CTest ctor is called (I can't step into the code for some reason) I
get the exception.
Anyone know what could be going on? Any ideas??

Thanks,
Steve
 
Project settings are "Mixed Mode" with /noentry
linking with: mscoree.lib
also using: __DllMainCRTStartup@12
 
Hi steve

Hi Steve,

How do we turn off managed class in MSVS 2003 .Net . I have the same problem of stack overflow error.
Regards,
Georgie.
 
Back
Top