chickadee » foreigners » define-foreign-record-type

(define-foreign-record-type name [decl ...] slot ...)syntax

This macro defines accessor procedures for a C structure definition. It is the counterpart to Chicken 3's define-foreign-record, but modeled after SRFI 9's define-record-type for better hygiene.

NAME should either be a symbol or a list of the form (TYPENAME FOREIGNNAME). If NAME is a symbol, then a C declaration will be generated that defines a C struct named struct NAME. If NAME is a list, then no struct declaration will be generated and FOREIGNNAME should name an existing C record type. A foreign-type specifier named NAME (or TYPENAME) will be defined as a pointer to the given C structure.