I have C# windows application which calling C++ unmanaged dll function. this application is working fine at windows XP x86 environment. now i move this application to WIN7 64 bit environment. I complied c++ dll at x64, and build my C# application at x64 as well. when i run my application, I got error message showed "System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt." when my application calling c++ dll function.
the code in my C# as show below:
private static extern long CalSpotForwardSimulation(int A, int B, int C,
int vDate, int sDate, int eDate, double hisCurve, double monthVol,
double dailyVol, double forwardCurves, string curveNames,
double dailyVal, double monthVal,double corrVal)
CalSpotForwardSimulation(numFactors, numLoc, numSims,lCobDate, lStartDate, lendDate, hisCurves, monthVol, dailyVol,forwardCurves, curveNames, dailyVal, monthVal, corrVal);
the code in C++ as show below:
__declspec(dllexport) long __stdcall
CalSpotForwardSimulation(int ltempOfFactors, int ltempOfLoc,
int ltempOfSims ,int vDate,int sDate,int eDate,
double * tempCurveHistorical,double * tempMonthlyVol,
double * tempDailyVol,double * tempForwardCurve,
char ** curveName,double dailyRet,
double monthRet,double corrRet)
I have been working on this issue for weeks, any suggestion to solve this problem?