Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2005

Tip: Looking for answers? Try searching our database.

StackOverflowException after calling unmanaged ctor

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SteveK - 23 Sep 2004 23:36 GMT
**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
SteveK - 23 Sep 2004 23:45 GMT
Project settings are "Mixed Mode" with /noentry
linking with: mscoree.lib
also using: __DllMainCRTStartup@12

> **Newbie with managed C++**
>
[quoted text clipped - 41 lines]
> Thanks,
> Steve
SteveK - 23 Sep 2004 23:53 GMT
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/vcco
nconvertingmanagedextensionsforcprojectsfrompureintermediatelanguagetomixedmode.
asp


static int minitialize() {

     int retval = 0;

     try

     {

           __crt_dll_initialize();

     }

     catch(System::Exception* e)

     {

           Console::WriteLine(e);

           retval = 1;

     }

     return retval;

}

static int mterminate() {

     int retval = 0;

     try

     {

           __crt_dll_terminate();

     }

     catch(System::Exception* e)

     {

           Console::WriteLine(e);

           retval = 1;

     }

     return retval;

}

> Project settings are "Mixed Mode" with /noentry
> linking with: mscoree.lib
[quoted text clipped - 48 lines]
> > Thanks,
> > Steve
GVG7 - 30 Jun 2005 10:33 GMT
Hi Steve,

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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.