如何将下面的c结构改成delphi的记录类型:
typedef struct {
unsigned long version_major;
unsigned long version_minor;
void *current_attribute;
unsigned long port_type;
char port_name[128];
unsigned short port_number;
unsigned short port_connection_tries; HANDLE port_fd;
SOCKET port_socket;
int receive_block;
char debug_name[128];
FILE *debug_log;
unsigned char wsdebug;
char error_string[80];
} g4_inter_t;
typedef struct {
unsigned long version_major;
unsigned long version_minor;
void *current_attribute;
unsigned long port_type;
char port_name[128];
unsigned short port_number;
unsigned short port_connection_tries; HANDLE port_fd;
SOCKET port_socket;
int receive_block;
char debug_name[128];
FILE *debug_log;
unsigned char wsdebug;
char error_string[80];
} g4_inter_t;
解决方案 »
- 如何给程序定义加号(+)为快捷键?
- 新年快乐啊。。。散分...注:回复时间里面包含数子21的每位20分...不够给再开一贴
- WIN98下怎么用ADO?
- UDP外网和内网通信
- ×××××大侠帮忙看看多线程的代码,怎么编译不过去啊???×××××
- 如何声明两个相同函数名和参数名,但参数类型不同的函数?
- TreeView问题(加分的好机会啊!!!,在线等!)
- DELPHI动态按钮CAPTION的问题
- 求购这本书
- 那里有tts(text to speech)控件下载?
- 请网络方面文件传输高手进来看看!
- 串口接收数据时,运行几次后,提示variant or safe array index of out bounds错误!!求助各位朋友!谢谢!!
type g4_inter_t =Record
version_major:longword;
version_minor:longword;
current_attribute:^pointer;
port_type:longword;
port_name:array[0..128] of char;
port_number:word;
port_connection_tries:word;
prot_fd:Thandle;
port_socket:Tsocket;
receive_block:integer;
debug_name:array[0..128] of char;
debug_log:^file;
wsdebug:widechar;
error_string:array[0..80] of char;
end;
version_major:longword;
version_minor:longword;
current_attribute: pointer;
port_type:longword;
port_name:array[0..127] of char;
port_number:word;
port_connection_tries:word;
prot_fd:Thandle;
port_socket:Tsocket;
receive_block:integer;
debug_name:array[0..127] of char;
debug_log:^file;
wsdebug:byte;
error_string:array[0..79] of char;
end;
C里面 char debug_name[128]; delphi里面的范围时 [0..127]的
version_major:longword;
version_minor:longword;
current_attribute: pointer;
port_type:longword;
port_name:array[0..127] of char;
port_number:word;
port_connection_tries:word;
prot_fd:Thandle;
port_socket:socket;
receive_block:integer;
debug_name:array[0..127] of char;
debug_log:^file;
wsdebug:byte;
error_string:array[0..79] of char;
end;
但我现在的关键问题要用到一个dll文件中的函数.该函数的返回值是上面这个结构类型的指针.
我在程序中导入这个函数:
function G4Open(BaseStationName:pchar;const status:Longint;const error_string:pchar;CustomInfoTable:^pointer;const CustomInfoFileName:array of char):^g4_inter_t;stdcall;external DLLNAME ;
编译时指向这一行报错[Error] intermec2100Def.pas(36): Identifier expected but '^' found
function G4Open(BaseStationName:pchar;const status:Longint;const error_string:pchar;CustomInfoTable:^pointer;const CustomInfoFileName:array of char):Pg4_inter_t;stdcall;external DLLNAME ;