需要在public中声明一个外部可调用函数,函数的参数类型是小弟我自定义的,在哪个地方定义这个类型呢
需要在public中声明一个外部可调用函数,函数的参数类型是我自定义的,在哪个地方定义这个类型呢
unit BootMain;
interface
uses
{此处省略}
type
{此处省略}
private
{ Private declarations }
public
{ Public declarations }
type TVCI_CAN_OBJ = record
ID : integer;
TimeStamp: integer;
TimeFlag: byte;
SendType:BYTE ;
RemoteFlag: BYTE;
ExternFlag: BYTE;
DataLen: BYTE;
Data: array[0..7] of Byte;
Reserved:array[0..2] of Byte;
end;
pVCI_CAN_OBJ=^TVCI_CAN_OBJ;
function FD_Transmit(DevType:dword;DevIndex:dword; CANindex:dword; psend:pVCI_CAN_OBJ;len:integer):integer ;stdcall;
external 'CANApplication.dll'; //返回实际发送的帧数
end;
在另一个unit中调用函数FD_Transmit,但是声明不成功,
这样写就报错:[ERROR]‘END’ expected but 'TYPE' found
[ERROR]'IMPLEMENTATION' expected but ';' found
[ERROR]'.' expected but 'IMPLEMENTATION' found
不知道如何解决,请各位指教!
------解决方案--------------------
你这个还是累成员函数,需要通过类实例调用,你应该声明一个类级函数
------解决方案--------------------
在另外一个unit中声明,然后引用这个unit
------解决方案--------------------
unit BootMain;
interface
uses
{此处省略}
type
{此处省略}
private
{ Private declarations }
public
{ Public declarations }
type TVCI_CAN_OBJ = record
ID : integer;
TimeStamp: integer;
TimeFlag: byte;
SendType:BYTE ;
RemoteFlag: BYTE;
ExternFlag: BYTE;
DataLen: BYTE;
Data: array[0..7] of Byte;
Reserved:array[0..2] of Byte;
end;
pVCI_CAN_OBJ=^TVCI_CAN_OBJ;
function FD_Transmit(DevType:dword;DevIndex:dword; CANindex:dword; psend:pVCI_CAN_OBJ;len:integer):integer ;stdcall;
external 'CANApplication.dll'; //返回实际发送的帧数
end;
在另一个unit中调用函数FD_Transmit,但是声明不成功,
这样写就报错:[ERROR]‘END’ expected but 'TYPE' found
[ERROR]'IMPLEMENTATION' expected but ';' found
[ERROR]'.' expected but 'IMPLEMENTATION' found
不知道如何解决,请各位指教!
------解决方案--------------------
你这个还是累成员函数,需要通过类实例调用,你应该声明一个类级函数
------解决方案--------------------
在另外一个unit中声明,然后引用这个unit
------解决方案--------------------