Next Previous Up Top Contents Index

5 Function and Macro Reference

define-c-struct

Macro

Summary

Defines an FLI structure type specifier corresponding to the Cstruct type.
Package

fli

Signature

define-c-struct name &rest slot-descriptions => list

slot-descriptions ::= {slot-name | (slot-name slot-type)}*

Arguments

name

The name of the new structure type specifier.

slot-descriptions

A sequence of symbols, possibly with type descriptions, naming the slots of the structure.

slot-name

A symbol naming the slot.

slot-type

The FLI type of the slot.

Values

list

The list(:structname).

Description

The macrodefine-c-struct is used to define an FLI structure type specifier, which corresponds to the Cstruct type. It is a convenience function, as a structure type could also be defined usingdefine-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 theforeign-slot-type andforeign-slot-value functions.
Example

In the following example a structure is defined usingdefine-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; };

See Also

define-c-enum
define-c-typedef
define-c-union
define-foreign-type
foreign-slot-names
foreign-slot-type
foreign-slot-value

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker