Delphi怎么声明C++带函数的结构体及声明带结构体参数的函数(50分)

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

ljjlow

Unregistered / Unconfirmed
GUEST, unregistred user!
由于本人对c++不是很熟,想请教各位,怎样把下面这个函数转换为delphi语法的
extern "C"
struct headcall_phone_interface_in *headcall_phone_connector(
headcall_phone_interface_out *main_hpo ,
HEADCALL_DEVICE_MICROPHONE *main_mic ,
HEADCALL_DEVICE_SPEAKER *main_spk ,
HEADCALL_DEVICE_CAMERA *main_cam ,
HEADCALL_DEVICE_DISPLAY *main_lcd ,
HEADCALL_DEVICE_DISPLAY *main_local_lcd ) ;
 
Type
headcall_phone_connector =record
main_hpo :headcall_phone_interface_out;
main_mic : ^HEADCALL_DEVICE_MICROPHONE;
main_spk : ^HEADCALL_DEVICE_SPEAKER
// 以下类似
HEADCALL_DEVICE_CAMERA *main_cam ,
HEADCALL_DEVICE_DISPLAY *main_lcd ,
HEADCALL_DEVICE_DISPLAY *main_local_lcd
end;
headcall_phone_interface_in = ^headcall_phone_connector;
 
headcall_phone_connector在C++中是个函数,怎么在delphi是要声明为record吗
 
比如带函数的结构体HEADCALL_DEVICE_SPEAKER定义如下:
struct HEADCALL_DEVICE_SPEAKER
{
void (*start) ( int frame_size );
void (*stop ) ( ) ;
void (*play ) ( char frame[], int recording );
void (*playfile) ( char* wavfile );
} ;然后问下在delphi中如何定义
另外,headcall_phone_connector方法在delphi又是怎么定义?谢谢了
 
函数???
function headcall_phone_connector(
main_hpo :headcall_phone_interface_out;
main_mic : ^HEADCALL_DEVICE_MICROPHONE;
main_spk : ^HEADCALL_DEVICE_SPEAKER
// 以下类似
... ...
) :headcall_phone_interface_in;stdcall;
 
headcall_phone_interface_out为什么不是传指针进去呢,还有返回的headcall_phone_interface_in
 
你是倒着问啊,所以哪个知道你的意思!

struct HEADCALL_DEVICE_SPEAKER
{
void (*start) ( int frame_size );
void (*stop ) ( ) ;
void (*play ) ( char frame[], int recording );
void (*playfile) ( char* wavfile );
}
Type
StartFun = Function (frame_size:Integer);
PlayFun = Function (const frame:string, recording :Integer);
PlayFileFun = Function (wavfile:string);
TProc = Procedure;

HEADCALL_DEVICE_SPEAKER=record
begin
start:StartFun;
stop:TProc
// 以下累世
end;
 

Similar threads

后退
顶部