tcc_struct: Declare struct for FFI helper generation

tcc_structR Documentation

Declare struct for FFI helper generation

Description

Generate R-callable helpers for struct allocation, field access, and pointer management. The struct must be defined in a header.

Usage

tcc_struct(ffi, name, accessors)

Arguments

ffi

A tcc_ffi object

name

Struct name (as defined in C header)

accessors

Named list of field accessors where names are field names and values are FFI types (e.g., list(x="f64", y="f64")). Named nested struct fields can use "struct:<name>" to generate borrowed nested-view getters and copy-in setters (for example child = "struct:child").

Value

Updated tcc_ffi object

Examples

## Not run: 
ffi <- tcc_ffi() |>
  tcc_header("#include <point.h>") |>
  tcc_struct("point", list(x = "f64", y = "f64", id = "i32"))

## End(Not run)

Rtinycc documentation built on April 28, 2026, 1:07 a.m.