用DELPHI如何调用VC写的DLL(30分)

  • 主题发起人 主题发起人 lakie
  • 开始时间 开始时间
L

lakie

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,请用过这个的朋友说明一下在DELPHI里如何做声明
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 『Delphi和C++数据类型对照表』<br><br>Delphi &nbsp; &nbsp; &nbsp; &nbsp;字长/值域 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;C++<br><br>ShortInt &nbsp; &nbsp;8位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;signed char<br>SmallInt &nbsp; &nbsp;16位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;short<br>LongInt &nbsp; &nbsp; &nbsp; &nbsp;32位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int<br>Byte &nbsp; &nbsp; &nbsp; &nbsp;8位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned char<br>Word &nbsp; &nbsp; &nbsp; &nbsp;16位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned short<br>Integer &nbsp; &nbsp; &nbsp; &nbsp;32位有符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int<br>Cardinal &nbsp; &nbsp;32位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned int<br>Boolean &nbsp; &nbsp; &nbsp; &nbsp;真/假 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bool<br>ByteBool &nbsp; &nbsp;真/假 或 8位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned char<br>WordBool &nbsp; &nbsp;真/假 或 16位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned short<br>LongBool &nbsp; &nbsp;真/假 或 32位无符号整型 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BOOL (WinAPI)<br>AnsiChar &nbsp; &nbsp;8位无符号字符 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char<br>WideChar &nbsp; &nbsp;宽字编码字符 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wchar_t<br>Char &nbsp; &nbsp; &nbsp; &nbsp;8位无符号字符 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char<br>AnsiString &nbsp; &nbsp;Delphi的字符串类 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AnsiString 类<br>String[n] &nbsp; &nbsp;老式的Delphi字符串, n = 1..255字节 &nbsp; &nbsp;SmallString&lt;n&gt; 模板类<br>ShortString &nbsp; &nbsp;老式的Delphi字符串, 255字节 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SmallString&lt;255&gt;<br>String &nbsp; &nbsp; &nbsp; &nbsp;Delphi的AnsiString类 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AnsiString<br>Single &nbsp; &nbsp; &nbsp; &nbsp;32位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;float<br>Double &nbsp; &nbsp; &nbsp; &nbsp;64位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double<br>Extended &nbsp; &nbsp;80位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;long double<br>Real &nbsp; &nbsp; &nbsp; &nbsp;32位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double<br>Pointer &nbsp; &nbsp; &nbsp; &nbsp;32无类型指针 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;void *<br>PChar &nbsp; &nbsp; &nbsp; &nbsp;32位字符型指针 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned char *<br>PAnsiChar &nbsp; &nbsp;32位ANSI型字符指针 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned char *<br>Comp &nbsp; &nbsp; &nbsp; &nbsp;64位浮点数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Comp 类<br>OleVariant &nbsp; &nbsp;OLE可变类型值 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OleVariant 类<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;『Win32API与C语言数据类型对照表』<br><br>Win32API &nbsp; &nbsp; &nbsp; C语言<br><br>HANDLE &nbsp; &nbsp; &nbsp; &nbsp; void*<br>BYTE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned char<br>SHORT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;short<br>WORD &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned short<br>INT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int<br>UINT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned int<br>LONG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long<br>BOOL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long<br>DWORD &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned long<br>ULONG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned long<br>CHAR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char<br>LPSTR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char*<br>LPCSTR &nbsp; &nbsp; &nbsp; &nbsp; const char*<br>LPWSTR &nbsp; &nbsp; &nbsp; &nbsp; wchar_t*<br>LPCWSTR &nbsp; &nbsp; &nbsp; &nbsp;const wchar_t*<br>FLOAT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;float<br>DOUBLE &nbsp; &nbsp; &nbsp; &nbsp; double<br>
 
function abc;stdcall 'c:/abc/abc.dll'
 
能不能说清楚些,<br>function abc;stdcall 'c:/abc/abc.dll'<br>然后把函数ABC如何处理?得到动态连接库里的函数呢
 
看看Delphi自己带的Windows单元,照着里面的做就OK了
 
function abc;stdcall 'c:/abc/abc.dll'<br>其中函数abc是abc.dll里面的函数,你必须知道这个函数的作用,<br>然后在Delphi里这样声明之后,在适当的地方调用就行了
 
DLL调用跟DLL是用什么语言编的没多大关系,调用方法是一样的,只要把函数声明中的参数类型写对了就可以啦。
 
后退
顶部