Hi Paul...
As you said, I changed the impementation for the dll functions to use char* instead of std::string. But I am still getting the same error...
I am not using any macro for calling conventions and also not specifying any calling convetion while declaring/defing the function.
I am posting the code for the dll as well as client below...
Code://ActivatorShimWrapper.h //declaration bool GenerateSerialNumber(const char* strActivationCode, const char* strVID, const char* strPID, char* strSerialNumber);Code://CActivatorShimWrapper.cpp // bool CActivatorShimWrapper::GenerateSerialNumber(const char* szActivationCode, const char* szVID, const char* szPID, char* szSerialNumber) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); string strActivationCode(szActivationCode); string strVID(szVID); string strPID(szPID); //validate parameters if( 0 == strActivationCode.length() || 0 == strVID.length() || 0 == strPID.length() ) { return false; } }
Client :
Code:typedef bool (*GenerateSerialNumber)(const char* strActivationCode, const char* strVID, const char* strPID, char* strSerialNumber); ... ... void CTestActivatorShimDlg::OnBnClickedOk() { HMODULE hModule = LoadLibrary("C:\\Portal_VC8\\KeyPoint\\ActivatorShimDll\\debug\\ActivatorShimDll.dll"); GenerateSerialNumber ptrGenerate; ptrGenerate = (GenerateSerialNumber)GetProcAddress(hModule,"GenerateSerialNumber"); bool bRet = true; char* szRes = new char[10]; memcpy(szRes,"",10); string str2(""); bRet = ((*ptrGenerate)(str2.c_str(),str2.c_str(),str2.c_str(),szRes)); delete []szRes; FreeLibrary(hModule); }
Thanks...




Reply With Quote