Struct defines the memory layout of a C struct, supporting serialization/deserialization. It works with ffi.ptr to pass data to C functions.
Example
Struct()
| Parameter | Type | Description |
|---|---|---|
fields | Record<string, string> | Field name to type code mapping |
StructSchema
size
create()
fromPtr()
get()
set()
ARM64 Alignment Rules
| Type Code | C Type | Size | Align |
|---|---|---|---|
c | char / int8_t | 1 | 1 |
i | int32_t / int | 4 | 4 |
l | int64_t / uint64_t | 8 | 8 |
d | double | 8 | 8 |
f | float | 4 | 4 |
b | bool | 1 | 1 |
s | const char* (pointer) | 8 | 8 |
p / k | void* / function pointer | 8 | 8 |