在Delphi7下如何声明C写的DLL的函数?具体见内。(100分)

  • 主题发起人 主题发起人 UnKnow365
  • 开始时间 开始时间
U

UnKnow365

Unregistered / Unconfirmed
GUEST, unregistred user!
以下是用C++写的一个DLL的.H文件,我对C不熟悉,请问在Delphi7下如何声明以下这些函数(静态加载,请给出函数声明,最好能解释一下),谢谢!
#ifdef _WIN32
#define STDCALL __stdcall
#else
#define STDCALL
#endif
#ifndef SDTAPI_
#define SDTAPI_
#ifdef __cplusplus
extern "C"{
#endif
/**********************************************************
********************** 端口类API *************************
**********************************************************/
int STDCALL SDT_SetMaxRFByte(int iPortID,unsigned char ucByte,int bIfOpen);
int STDCALL SDT_GetCOMBaud(int iComID,unsigned int *puiBaud);
int STDCALL SDT_SetCOMBaud(int iComID,unsigned int uiCurrBaud,unsigned int uiSetBaud);
int STDCALL SDT_OpenPort(int iPortID);
int STDCALL SDT_ClosePort(int iPortID);
int STDCALL SDT_GetErrorString(int ErrorCode, char * ErrorString);

/**********************************************************
********************** SAM类API **************************
**********************************************************/
int STDCALL SDT_GetSAMStatus(int iPortID,int iIfOpen);
int STDCALL SDT_ResetSAM(int iPortID,int iIfOpen);
int STDCALL SDT_GetSAMID(int iPortID,unsigned char *pucSAMID,int iIfOpen);
int STDCALL SDT_GetSAMIDToStr(int iPortID,char *pcSAMID,int iIfOpen);

/**********************************************************
******************* 卡类API ************************
**********************************************************/
int STDCALL SDT_StartFindIDCard(int iPortID,unsigned char *pucIIN,int iIfOpen);
int STDCALL SDT_SelectIDCard(int iPortID,unsigned char *pucSN,int iIfOpen);
int STDCALL SDT_ReadBaseMsg(int iPortID,unsigned char * pucCHMsg,unsigned int * puiCHMsgLen,unsigned char * pucPHMsg,unsigned int *puiPHMsgLen,int iIfOpen);
int STDCALL SDT_ReadFPMsg(int iPortID,unsigned char * pucFPMsg,unsigned int * puiFPMsgLen,int iIfOpen);
int STDCALL SDT_ReadIINSNDN(int iPortID,unsigned char * pucIINSNDN,int iIfOpen);
int STDCALL SDT_ReadNewAppMsg(int iPortID,unsigned char * pucAppMsg,unsigned int * puiAppMsgLen,int iIfOpen);


int STDCALL SDT_ReadBaseMsgToFile(int iPortID,char * pcCHMsgFileName,unsigned int * puiCHMsgFileLen,char * pcPHMsgFileName,unsigned int *puiPHMsgFileLen,int iIfOpen);
int STDCALL SDT_ReadIINSNDNToASCII(int iPortID, unsigned char *pucRecvData,int iIfOpen);

#ifdef __cplusplus
}
#endif
#endif
 
function SDT_OpenPort(iPortID: Integer): integer; STDCALL;external 'c.dll'

function SDT_GetErrorString(ErrorCode:integer;var ErrorString: array of char);integer;STDCALL;external 'c.dll'
大概是这样吧.
 
unit CDLLStatUnit;

interface

uses Windows;

const
DLLName='c.dll';

// **** 端口类API(开始) *****
function SDT_SetMaxRFByte(iPortID:integer;ucByte:char;bIfOpen:integer):integer;
stdcall; external DLLName;

function SDT_GetCOMBaud(iComID:integer;puiBaud:PDWORD):integer;
stdcall; external DLLName;

function SDT_SetCOMBaud(iComID:integer;uiCurrBaud,uiSetBaud:DWORD);
stdcall; external DLLName;

function SDT_OpenPort(iPortID:integer):integer; stdcall; external DLLName;

function SDT_ClosePort(iPortID:integer):integer; stdcall; external DLLName;

function SDT_GetErrorString(ErrorCode:integer;ErrorString:PChar):integer;
stdcall; external DLLName;
// **** 端口类API(结束) *****

// **** SAM类API(开始) ****
function SDT_GetSAMStatus(iPortID,iIfOpen:integer):integer;
stdcall; external DLLName;

function SDT_ResetSAM(iPortID,iIfOpen:integer):integer;
stdcall; external DLLName;

function SDT_GetSAMID(iPortID:integer;pucSAMID:PChar;iIfOpen:integer):integer;
stdcall; external DLLName;

function SDT_GetSAMIDToStr(iPortID:integer;pcSAMID:PChar;
iIfOpen:integer):integer; stdcall; external DLLName;
// **** SAM类API(结束) ****

// **** 卡类API(开始) ****
function SDT_StartFindIDCard(iPortID:integer;pucIIN:PChar;
iIfOpen:integer):integer; stdcall; external DLLName;

function SDT_SelectIDCard(iPortID:integer;pucSN:PChar;iIfOpen:integer):integer;
stdcall; external DLLName;

function SDT_ReadBaseMsg(iPortID:integer;pucCHMsg:PChar;puiCHMsgLen:PDWORD;
pucPHMsg:PChar;puiPHMsgLen:PDWORD;iIfOpen:integer):integer;
stdcall; external DLLName;

function SDT_ReadFPMsg(iPortID:integer;pucFPMsg:PChar;puiFPMsgLen:PDWORD;
iIfOpen:integer):integer; stdcall; external DLLName;

function SDT_ReadIINSNDN(iPortID:integer;pucIINSNDN:PChar;
iIfOpen:integer):integer; stdcall; external DLLName;

function SDT_ReadNewAppMsg(iPortID:integer;pucAppMsg:PChar;puiAppMsgLen:PDWORD;
iIfOpen:integer):integer; stdcall; external DLLName;

function SDT_ReadBaseMsgToFile(iPortID:integer;pcCHMsgFileName:PChar;
puiCHMsgFileLen:PDWORD;pcPHMsgFileName:PChar;puiPHMsgFileLen:PDWORD;
iIfOpen:integer):integer; stdcall; external DLLName;

function SDT_ReadIINSNDNToASCII(iPortID:integer;pucRecvData:PChar;
iIfOpen):integer; stdcall; external DLLName;
// **** 卡类API(结束) ****

implementation

end.
 
先给分,回头调度通过再回复具体情况。
 
后退
顶部