# managed c++ 1.0 wrapper for novodex

This topic is 4852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am trying to wrap the novodex library in the old .net 1.0 managed c++ language mainly for compatibility reasons so people don't have to install the beta 2.0 runtime. I however am having some problems, I get the following link error whenever I try to link to novodex: NovodexWrapper error LNK2001: unresolved external symbol "void __cdecl __CxxCallUnwindDtor(void (__thiscall*)(void *),void *)" (?__CxxCallUnwindDtor@@J0YAXP6EXPAX@Z0@Z) I do not see anything wrong with my code so it seems more the problem has more to do with how managed c++ links to unmanaged libraries perhaps. This is my code with a test dummy method. I get the error when I include novodex, but it compiles fine when I don't include it. And I am of course linking to the lib. Just wondering if anybody's got a clue?
#pragma once

using namespace System;
#using <mscorlib.dll>

#include    <novodex/nxphysics.h>

namespace SimpNameSpc
{
public __gc class  Simp
{
public:
int hello()
{
return 3;
}
};
}



##### Share on other sites
Perhaps it is this problem, which I had recently and recall seeing a missing external to CxxCallUnwindDtor. Basically the problem is that global variables can't be initialized safely in managed C++ DLLs, and the CRT uses such variables. Managed C++ DLLs therefore do not link to the CRT by default. If you intend to use the CRT, the solution is to manually initialize globals before any calls to code that uses the CRT, the process of which the article describes.

From the symptoms section of the article:
Quote:
 Note: you may receive the LNK2001 and LNK4210 errors with projects that are not affected by the issue described in this article. However, the project definitely is affected by the issue described in this article if resolving a LNK2001 or LNK4210 warning leads to a LNK4243 warning, or if linking the project generates a LNK4243 warning.

I assume Novodex links to the CRT; is it a static library? If that's the case, check to see if your project uses the CRT, and if not, try linking to the CRT and see if you get LNK4243. Sorry I can't describe this in more detail; I'm actually in the middle of installing Visual Studio.

##### Share on other sites
Quote:
Original post by mutex
Perhaps it is this problem, which I had recently and recall seeing a missing external to CxxCallUnwindDtor. Basically the problem is that global variables can't be initialized safely in managed C++ DLLs, and the CRT uses such variables. Managed C++ DLLs therefore do not link to the CRT by default. If you intend to use the CRT, the solution is to manually initialize globals before any calls to code that uses the CRT, the process of which the article describes.

From the symptoms section of the article:
Quote:
 Note: you may receive the LNK2001 and LNK4210 errors with projects that are not affected by the issue described in this article. However, the project definitely is affected by the issue described in this article if resolving a LNK2001 or LNK4210 warning leads to a LNK4243 warning, or if linking the project generates a LNK4243 warning.

I assume Novodex links to the CRT; is it a static library? If that's the case, check to see if your project uses the CRT, and if not, try linking to the CRT and see if you get LNK4243. Sorry I can't describe this in more detail; I'm actually in the middle of installing Visual Studio.

Woohoo, linking to msvcrt.lib fixed my problems! :)

1. 1
Rutin
73
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633426
• Total Posts
3011815
• ### Who's Online (See full list)

There are no registered users currently online

×