structInfo: Get information about a C-level struct type description

View source: R/struct.R

structInfoR Documentation

Get information about a C-level struct type description

Description

This function returns information about the size and offsets of the fields/elements of a foreign function interface struct definition.

Usage

structInfo(type)

Arguments

type

the StructFFIType object

Value

A list with 2 elements

size

an integer value giving the total size of a struct instance

offsets

the byte offsets of the individual elements

Author(s)

Duncan Temple Lang

See Also

sizeof structType

Examples

     # data structure for use in call to utsname
   type = structType(list('sysname' = stringArrayType(256),
                          'nodename' = stringArrayType(256),
                          'release' = stringArrayType(256),
                          'version' = stringArrayType(256),
                          'machine' = stringArrayType(256)))
   structInfo(type)
   sizeof(type)

   type = structType(list(d = doubleType, i = sint32Type))
   structInfo(type)
   sizeof(type)  


omegahat/Rffi documentation built on Nov. 29, 2023, 12:48 a.m.