用VC调用C写的DLL出错!

mudboy mudboy 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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....)
可我的参数信息没错呀,专家指导一下!·
...全文
评论 12
收藏 已收藏
分享
返回顶部
mudboy
进程/线程/DLL 15,466 成员 49,169 内容