I am using Visual Studio 2010 targeting .Net 4.0
I am working with an unmanaged C++ dll using a managed C++ wrapper. I am using _declspec(dllexport) to export the unmanaged .dll below is the header file for the unmanaged dll:
class DllExport KeyManager
{
public:
KeyManager(const char *pszKeyFileName, int thisProduct);
~KeyManager();
...
I am then making a call to the unmanaged dll from the managed wrapper here:
#include "stdafx.h"
#include "KeyModCLR.h"
#using <mscorlib.dll>
#include <msclr/marshal.h>
using namespace System;
using namespace System::Runtime::InteropServices;
using namespace msclr::interop;
MCKeyManager::MCKeyManager(String ^fileName, int thisProduct)
{
pszFileName = (char*)Marshal::StringToHGlobalAnsi(fileName).ToPointer();
m_pC = new KeyManager(pszFileName, thisProduct);
}
This all works great when the project targets Win32, however when I change the target platform to x64 as described here I get the following error:
Error 17 error LNK2019: unresolved external symbol "public: __cdecl
KeyManager::KeyManager (char const *,int)" (??0KeyManager@@$$FQEAA@PEBDH@Z) referenced in
function "public: __clrcall MCKeyManager::MCKeyManager(class System::String ^,int)" (?? 0MCKeyManager@@$$FQE$AAM@PE$AAVString@System@@H@Z)
I am not terribly familiar with C++ as I did not write this code so I don't know if I am missing something obvious. I have read that decoration of the imported functions are different for 64 bit and 32 bit but I am not sure how that necessarily affects me.
I have been looking for an answer all day and have come up short so any suggestions or advice would be greatly appreciated.
Thanks in advance