Managed C++ destructor bug?

M

Mark

I am having a problem using destructors in managed C++ and
would appreciate help in finding a solution.

Thanks

Mark

----------- Error and Test Code -------------------------

The linker throws this error when the code below is built:

testmanagedCxx error LNK2001: unresolved external
symbol "void __cdecl __CxxCallUnwindDtor(void (__thiscall*)
(void *),void *)" (?
__CxxCallUnwindDtor@@$$J0YAXP6EXPAX@Z0@Z)


// This is the main DLL file.

#include "stdafx.h"

#include "testmanagedCxx.h" // the header does not
contain any code

namespace testmanagedCxx
{
public __gc class Base
{
private:
String *s;
public:
Base() { s = new String(L"hello"); }
~Base() { s = 0; }
};

public __gc class Derived : public Base
{
public:
Derived() {}
~Derived() {}
};
}
 
J

Jeffrey Tan[MSFT]

Hello Mark,

I noticed that the issue has already been posted in .net VC group.
A colleague of mine has added a reply to you.

If you have follow up questions, please post there and he will work with
you.
Thanks for your understanding.


Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Mark" <[email protected]>
| Sender: "Mark" <[email protected]>
| Subject: Managed C++ destructor bug?
| Date: Sat, 27 Sep 2003 15:45:49 -0700
| Lines: 43
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOFSRlISc2ETxSOQfaOBwmPAwsYRg==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:187730
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I am having a problem using destructors in managed C++ and
| would appreciate help in finding a solution.
|
| Thanks
|
| Mark
|
| ----------- Error and Test Code -------------------------
|
| The linker throws this error when the code below is built:
|
| testmanagedCxx error LNK2001: unresolved external
| symbol "void __cdecl __CxxCallUnwindDtor(void (__thiscall*)
| (void *),void *)" (?
| __CxxCallUnwindDtor@@$$J0YAXP6EXPAX@Z0@Z)
|
|
| // This is the main DLL file.
|
| #include "stdafx.h"
|
| #include "testmanagedCxx.h" // the header does not
| contain any code
|
| namespace testmanagedCxx
| {
| public __gc class Base
| {
| private:
| String *s;
| public:
| Base() { s = new String(L"hello"); }
| ~Base() { s = 0; }
| };
|
| public __gc class Derived : public Base
| {
| public:
| Derived() {}
| ~Derived() {}
| };
| }
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top