麻烦把下列C语言函数的定义转化为Delphi的定义(100)

Z

znxia

Unregistered / Unconfirmed
GUEST, post messages is not allowed!
#1
麻烦哪位把下列函数CPM_InitPort和CPM_InitMaster的定义转化为delphi代码。------------------------typedef struct// canchannel{ BYTE bBoardNo; BYTE bPort;} CANChannelStruct;typedef struct cpmconfig{ BYTE AccCode[4]; BYTE AccMask[4]; BYTE BaudRate;} CPMConfigStruct;typedef struct packet{ LONGLONG MsgTimeStamps; BYTE mode; DWORD id; BYTE rtr; BYTE len; BYTE data[8];} PacketStruct;extern "C" __declspec(dllexport) WORD CALLBACK CPM_InitPort(BYTE bBoardNo,BYTE bPort,CANChannelStruct *ChannelHandle);extern "C" __declspec(dllexport) WORD CALLBACK CPM_InitMaster(CANChannelStruct *ChannelHandle, CPMConfigStruct *CanConfig, WORD wSDOTimeout);
 
A

autumn

Unregistered / Unconfirmed
GUEST, post messages is not allowed!
#2
Code:
type  CANChannelStruct = record    bBoardNo:BYTE;
   bPort:BYTE;
 end;
 PCANChannelStruct = ^CANChannelStruct;
 CPMConfigStruct = record    AccCode:array[0..3] of BYTE;
   AccMask:array[0..3] of BYTE;
   BaudRate:BYTE;
 end;
   PCPMConfigStruct = ^CPMConfigStruct;
 PacketStruct = record    MsgTimeStamps:INT64;
   mode:BYTE;
   id:DWORD;
   rtr:BYTE;
   len:BYTE;
   data:BYTE;
 end;
function CPM_InitPort(bBoardNo:BYTE;bPort:BYTE;ChannelHandle:PCANChannelStruct):WORD;cdecl;function CPM_InitMaster(ChannelHandle:PCANChannelStruct;CanConfig:PCPMConfigStruct;wSDOTimeout:WORD):WORD;cdecl;
 
Top Bottom