C写的DLL中函数,在delphi中引用,如何在delphi中声明? ( 积分: 50 )

  • 主题发起人 主题发起人 zhoufujin
  • 开始时间 开始时间
Z

zhoufujin

Unregistered / Unconfirmed
GUEST, unregistred user!
C写的DLL中有一个函数,定义如下:<br>extern &quot;C&quot; __declspec(dllexport) BOOL __stdcall ReadData(HANDLE hDevice,short* pBuffer,ULONG *nCounts);<br>如果在delphi中引用,如何在delphi中声明?
 
C写的DLL中有一个函数,定义如下:<br>extern &quot;C&quot; __declspec(dllexport) BOOL __stdcall ReadData(HANDLE hDevice,short* pBuffer,ULONG *nCounts);<br>如果在delphi中引用,如何在delphi中声明?
 
Function &nbsp;ReadData(hDevice:THandle;var pBullfer:SmallInt;var nCounts:Cardinal):BOOL;stdcall;external DLLFileName;<br>//也等价下面的形式<br>//Function &nbsp;ReadData(hDevice:THandle,pBullfer:PSmallInt,nCounts:PCardinal);stdcall;external DLLFileName;
 
能用cdecl替换stdcall吗?
 
extern &quot;C&quot; __declspec(dllexport) BOOL ReadData(HANDLE hDevice,short* pBuffer,ULONG *nCounts);<br>extern &quot;C&quot; __declspec(dllexport) BOOL __cdecl ReadData(HANDLE hDevice,short* pBuffer,ULONG *nCounts);<br><br>对应<br>Function &nbsp;ReadData(hDevice:THandle;var pBullfer:SmallInt;var nCounts:Cardinal):BOOL;cdecl;external DLLFileName;<br>//也等价下面的形式<br>//Function &nbsp;ReadData(hDevice:THandle,pBullfer:PSmallInt,nCounts:PCardinal);cdecl;external DLLFileName; <br>不过cdecl是非常落后而缓慢的调用方式,不建议使用
 
后退
顶部