Managed C++ destructor bug?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    Managed C++ destructor bug?

    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 __CxxCallUnwind Dtor(void (__thiscall*)
    (void *),void *)" (?
    __CxxCallUnwind Dtor@@$$J0YAXP6 EXPAX@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() {}
    };
    }

  • Jeffrey Tan[MSFT]

    #2
    RE: Managed C++ destructor bug?


    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" <mhh@yadayada.c om>
    | Sender: "Mark" <mhh@yadayada.c om>
    | Subject: Managed C++ destructor bug?
    | Date: Sat, 27 Sep 2003 15:45:49 -0700
    | Lines: 43
    | Message-ID: <14f2701c38549$ 19482090$a60128 0a@phx.gbl>
    | 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: AcOFSRlISc2ETxS OQfaOBwmPAwsYRg ==
    | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
    | Path: cpmsftngxa06.ph x.gbl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1877 30
    | NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 __CxxCallUnwind Dtor(void (__thiscall*)
    | (void *),void *)" (?
    | __CxxCallUnwind Dtor@@$$J0YAXP6 EXPAX@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() {}
    | };
    | }
    |
    |

    Comment

    Working...