define-c-struct name &rest slot-descriptions => list
slot-descriptions ::= { slot-name | ( slot-name slot-type )}*
The name of the new structure type specifier.
A sequence of symbols, possibly with type descriptions, naming the slots of the structure.
A symbol naming the slot.
The FLI type of the slot.
The macro
define-c-struct
is used to define an FLI structure type specifier, which corresponds to the C
struct
type. It is a convenience function, as a structure type could also be defined using define-foreign-type.
A structure is an aggregate type, or collection, of other FLI types. The types contained in a structure are referred to as slots, and can be accessed using the define-foreign-type and foreign-slot-value functions.
In the following example a structure is defined using
define-c-struct
, and the corresponding C code is given.
(fli:define-c-struct a-point (x :int)
(y :int)
(color :byte)
(ident :char))
struct a-point {
int x;
int y;
byte color;
char ident;
};
define-c-enum
define-c-typedef
define-c-union
define-foreign-type
foreign-slot-names
foreign-slot-type
foreign-slot-value