A
AroDeep
Guest
Facing Issues while migrating C++ applications from VS 2010 to VS 2017. Major challenge is with dynamic load libraries (LoadLibrary) projects. There are around 500 projects and reusing the code in many application. So Changing any code , will be very difficult.
HINSTANCE hModule;
CSiRuleReturn *pRuleRet = NULL;
FIRERULE pFunc;
hModule = LoadLibrary("SiRGetJOBTemplate.DLL");
pFunc = (FIRERULE)GetProcAddress(hModule, "FireRule");
if (pFunc != NULL)
{
CObList inputList;
BuildModuleInputList(stdInput, inputVals, inputList);
try {
pRuleRet = pFunc(inputList);
}
catch (CException *)
{
DeleteModuleInputList(inputList);
throw;
}
DeleteModuleInputList(inputList);
if (pRuleRet == NULL)
{
CString msg;
msg.Format("The result module [%s] failed to return a RuleReturn. Firing with the defintion on line %d of %s", m_moduleName, m_fileLineNumber, m_ruleFile);
CSiException *pEx = new CSiException("CSiResultRule::FireRule", msg);
throw pEx;
}
if (pRuleRet->GetReturnCode() > retVal.GetReturnCode())
{
retVal.SetReturnCode(pRuleRet->GetReturnCode());
}
if (pRuleRet->GetReturnObject())
{
retVal.SetReturnObject(pRuleRet->GetReturnObject());
}
retVal.AppendErrors(pRuleRet->GetErrorList());
delete pRuleRet;
Code works fine... it load the DLL dynamically and executes the function. but after it throws "Access Violation"... may be corrupts the main memory/thread.
Please help me on this.
Continue reading...
HINSTANCE hModule;
CSiRuleReturn *pRuleRet = NULL;
FIRERULE pFunc;
hModule = LoadLibrary("SiRGetJOBTemplate.DLL");
pFunc = (FIRERULE)GetProcAddress(hModule, "FireRule");
if (pFunc != NULL)
{
CObList inputList;
BuildModuleInputList(stdInput, inputVals, inputList);
try {
pRuleRet = pFunc(inputList);
}
catch (CException *)
{
DeleteModuleInputList(inputList);
throw;
}
DeleteModuleInputList(inputList);
if (pRuleRet == NULL)
{
CString msg;
msg.Format("The result module [%s] failed to return a RuleReturn. Firing with the defintion on line %d of %s", m_moduleName, m_fileLineNumber, m_ruleFile);
CSiException *pEx = new CSiException("CSiResultRule::FireRule", msg);
throw pEx;
}
if (pRuleRet->GetReturnCode() > retVal.GetReturnCode())
{
retVal.SetReturnCode(pRuleRet->GetReturnCode());
}
if (pRuleRet->GetReturnObject())
{
retVal.SetReturnObject(pRuleRet->GetReturnObject());
}
retVal.AppendErrors(pRuleRet->GetErrorList());
delete pRuleRet;
Code works fine... it load the DLL dynamically and executes the function. but after it throws "Access Violation"... may be corrupts the main memory/thread.
Please help me on this.
Continue reading...