调用外部DLL出错
两个函数 第一个能成功调用 第二个报错代码如下:
#include <iostream.h>
#include<windows.h>
void main(void)
{
typedef int (*findEqm)(char *IP, BOOL Flag); //
typedef int (*DataRtn) (char *desIP, int eqmNo, int bits); //
findEqm Fun=NULL;
DataRtn Fun2=NULL;
HINSTANCE hDLL;
hDLL=LoadLibrary("SetTimedll.dll");
Fun=(findEqm)GetProcAddress(hDLL,"findEqm");
Fun2=(DataRtn)GetProcAddress(hDLL,"DataRtn");
if(Fun)
{
int A=Fun("192.168.0.30",1);
cout<<"结果为"<<A<<endl;
}
if(Fun2)
{
int B=Fun2("192.168.0.30",1,6); //出错"the value of esp was not properly ...."
cout<<"结果为:"<<B<<endl;
}
FreeLibrary(hDLL);//卸载MyDll.dll文件;
}