Jump to content
  • Advertisement
Sign in to follow this  
Khaos Dragon

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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! :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!