用VC调用C写的DLL出错!
C的DLL我已在C下测试过,没问题,调用的原型如下:
SLogResult * getLogResult(char whereclause[300])
SLogResult * CLogPickDlg::LoadDLLGetLog(CString filter)
{
typedef UINT (CALLBACK* LPFNGETLOG)(char fi[300]);
HINSTANCE hInstance1;
LPFNGETLOG lpSquartRoot1;
hInstance1 = ::LoadLibrary("getlog.exe");
if (hInstance1 != NULL)
{
lpSquartRoot1 = (LPFNGETLOG)::GetProcAddress(hInstance1,"getLogResult");
if(!lpSquartRoot1)
{
::FreeLibrary(hInstance1);
AfxMessageBox("定位动态链接库方法出错!!!");
}
else
{
char fil[300];
const char *fil1=NULL;
fil1=(LPCTSTR)filter;
strcpy(fil,fil1);
strcat(fil,"\0");
this->p_logfromc=(SLogResult *)lpSquartRoot1(fil);//err
this->getLogFromC();
}
::FreeLibrary(hInstance1);
}
return p_logfromc;
}
但运行时总是出错(Debug error,the value of ESP was not properly saved across a function call....)
可我的参数信息没错呀,专家指导一下!·