精通C和Delphi的朋友帮我看下这两个C中的struct如何转化为Delphi中的record

来源:百度知道 编辑:UC知道 时间:2024/06/04 00:24:45
第一个C struct:
struct table_entry
{
/* The entry type
*/
uint32_t entry_type;

union
{
/* The value type
*/
uint32_t value_type;

/* The value_descriptor
*/
uint32_t value_descriptor;
};
union
{
/* The value data
*/
uint8_t *value_data;

/* The entry guid
*/
uint8_t *entry_guid;
};
union
{
/* The size of the value data
*/
size_t value_data_size;

/* The size of the entry guid
*/
size_t entry_guid_size;
};
};

第二个C struct:
struct index_values
{
/* The identifier value
*/
uint64_t identifier;

union
{
/* Definition for offset index and descriptor index branch node
* and offset index leaf node
*/
struct
{
/* The file offset
*/
off64_t file

第一个
table_entry = packed record
entry_type:Cardinal;
case Integer of
0:(
value_type:Cardinal;
value_data:^Byte;
value_data_size::integer
);
1:(
value_descriptor:Cardinal
entry_guid:^Byte;
entry_guid_size:integer
);
end;

第二个太长了,看的眼花了。
uint64_t是无符号64位整数,delphi里面好像没有这样的类型,最接近了是INT64,不过是带符号的。

packed不用也应该没问题的。