用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....)
可我的参数信息没错呀,专家指导一下!·
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....)
可我的参数信息没错呀,专家指导一下!·
...全文
相关推荐
VC调用C#写的DLL
这个例子很好解决了, VC和C#之间的互调的问题
JAVA调用C++/C#的DLL
由于项目的需要,最近研究了java 调用DLL的方法,将如何调用的写于此,便于日后查阅: 采用的方法是JNI:Java Native Interface,简称JNI,是Java平台的一部分,可用于让Java和其他语言编写的代码进行交互。 下面是从网上摘取的JNI工作示意图: 总体说明:先在JAVA中建立一个类,通过javac生成.class,再由javah生成.h;然后将
VB调用VC写的Dll,例程源码,有VB调用方法,和VC写Dll的源码
VB调用VC写的Dll,例程源码,有VB调用方法,和VC写Dll的源码
VB调用VC写的DLL返回数组
VB调用VC写的DLL返回数组,里面有VC,VB 及DLL源码
VC6生成DLL和调用DLL的最简单例子 入门级
VC6 生成与调用DLL的最简单例子。适合初学者学习用。


进程/线程/DLL
