调用VC DLL的问题(50分)

  • 主题发起人 主题发起人 南腔北调
  • 开始时间 开始时间

南腔北调

Unregistered / Unconfirmed
GUEST, unregistred user!
如下VC DLL函数该如何调用:<br>__declspec (dllimport) int __stdcall SendSM(const char *ServiceID,const char* Dest,const BYTE* Content,int ContentLength,char* FeeType,char* MsgID,BOOL Registered);<br><br>DELPHI(我写的):<br>function SendSM(const ServiceID,Dest,Content:pchar;ContentLength:integer;<br>var FeeType,MsgID:shortint;const Registered:bool):integer;stdcall;External 'THIS.dll';<br><br>好像有错,还请知道的说说
 
function SendSM(const ServiceID:pchar;<br>Dest:pchar;<br>Content:pbyte;{类型改成pbyte}<br>ContentLength:integer;<br>var FeeType,MsgID:shortint;<br>const Registered:bool):integer;stdcall;External 'THIS.dll';<br>
 
function SendSM(const ServiceID,Dest,Content:pchar;<br>ContentLength:integer;<br>FeeType,MsgID:pchar;<br>Registered:longbool):integer;stdcall;External 'THIS.dll';<br>
 
function SendSM(ServiceID,Dest,Content:pchar;ContentLength:integer;<br>FeeType:Pchar,MsgID:pchar;Registered:boolean):integer;stdcall;External 'THIS.dll';<br>
 
vc中:<br>const char* abc<br>char *abc<br>const BYTE* abc<br>DELPHI对应的应该是:<br>const abc:pchar<br>var abc:shortint<br>const abc:pbyte<br><br>不知道是否正确???<br>
 
&nbsp;CHAR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Char<br>&nbsp; LPSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PAnsiChar<br>&nbsp; LPCSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const char* &nbsp; &nbsp; PAnsiChar<br>&nbsp; PBYTE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const BYTE* &nbsp; &nbsp; Types.PByte
 
delphi中的const和var都是传地址的。所以const x: pchar和x: pchar传的内容两样,一个传的是x的地址(可以理解为指向指针的指针),一个是x的内容(一个指针)。不知道vc中const是否也如此?如果不是这么回事那么ffhello给的就是标准答案了
 
后退
顶部