Skip to contents

Returns a named integer vector with byte offsets for all fields. For packed structs, uses the pack alignment setting.

Usage

ffi_all_offsets(struct_type, use_pack = TRUE)

Arguments

struct_type

StructType object

use_pack

Logical, whether to use the struct's pack setting. Default TRUE.

Value

Named integer vector of offsets

Examples

if (FALSE) { # \dontrun{
Point <- ffi_struct(x = ffi_int(), y = ffi_double())
ffi_all_offsets(Point)
# x y
# 0 8

# Packed struct
Packed <- ffi_struct(a = ffi_uint8(), b = ffi_int32(), .pack = 1)
ffi_all_offsets(Packed)
# a b
# 0 1
} # }