NextPrevUpTopContentsIndex

define-c-struct

Macro
Summary

Defines an FLI structure type specifier corresponding to the C struct 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 (:struct name ) .

Description

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.

Example

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;
};
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 User Guide and Reference Manual - 27 Mar 2005

NextPrevUpTopContentsIndex