看看这函数怎么调?我搞了好久,请高手帮忙,关于DLL函数的调用。
VC中的声明
int ReadSrvReq(char* ctrlMsg, char* subCode,
char* contentMsg, int* msgLen,
int timeOut)
DELPHI中声明:
TReadSrvReq=function(ctrlMsg:Pchar;subCode:Pchar;contentMsg:Pchar; msgLen:integer;timeOut:integer):integer;stdcall;
调用:
mw:HWND;
mt:TCSGP_ReadConf;
mt1: TReadSrvReq;
a:integer;
st:string;
p:pchar;
ctrlMsg:string;
subCode:string;
contentMsg:string;
msgLen:integer;
time1:String;
mw:=loadlibrary('CSGPAPI_DLL.dll');
if mw<>0 then
try
mt1:=GetProcaddress(mw,'ReadSrvReq');
if assigned(mt1) then
a:=mt1(@ctrlMsg,@subCode,@contentMsg, msgLen,5);
finally
FreeLibrary(mw);
end;
到了这步a:=mt1(@ctrlMsg,@subCode,@contentMsg, msgLen,5);就出错了。
请问DLL函数应怎么声明,参数怎么传呢?