Delphi 7:
Function OpenComm(nComm:BYTE;nBaud:integer):integer; stdcall; far; External 'DllCom.dll';
执行正常
而在VC2003 :
typedef unsigned char (CALLBACK* LPOpenComm)(unsigned char nComm,long nBaud); hDLL = LoadLibrary(".\\DllCom.dll"); LPOpenComm LPOpenComm1;
LPOpenComm1 = (LPOpenComm)GetProcAddress(hDLL,"OpenComm"); uReturnVal = LPOpenComm1(1, 9600); 在执行最后一句时,出错:大概说是参数或返回值不对
应该如何在VC2003中进行定义?
Function OpenComm(nComm:BYTE;nBaud:integer):integer; stdcall; far; External 'DllCom.dll';
执行正常
而在VC2003 :
typedef unsigned char (CALLBACK* LPOpenComm)(unsigned char nComm,long nBaud); hDLL = LoadLibrary(".\\DllCom.dll"); LPOpenComm LPOpenComm1;
LPOpenComm1 = (LPOpenComm)GetProcAddress(hDLL,"OpenComm"); uReturnVal = LPOpenComm1(1, 9600); 在执行最后一句时,出错:大概说是参数或返回值不对
应该如何在VC2003中进行定义?
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer daclared with a different calling convention