Macro | Package: ff | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## defcstruct

Arguments: &rest body

This macro is obsolete and kept for backward compatibility only. Please use def-foreign-type.

This macro defines a C structure to Lisp by defining appropriate accessor and creator functions. The creator function is named make-name. The accessor function names for each slot are the hyphen-separated concatenation of the cstruct name and the slot name.

Argument name is either the name of this cstruct or a list. In the latter case the first element of the list is the name of the cstruct and the second element may be the keyword `:malloc`.

Each slot is a list. The first item on the list is a symbol naming the slot, and the rest of the list specifies the datatype. A datatype takes one of the following forms:

- A single keyword, which is one of the following:

    :char
    :byte
    :short
    :long
    :unsigned-byte
    :unsigned-short
    :unsigned-long
    :short-float
    :long-float

> This will provide space for the specified atomic C data type to be placed in that slot.

- A symbol, which must name a previously defined cstruct.
- *datatype where datatype is any valid datatype. As in C, the * indicates that the slot will contain a C pointer (an integer address) to an object of the specified type. Also, as in C, if datatype is a symbol, the requirement that a structure of that name already be defined is relaxed. Pointer slots should normally not contain addresses in Lisp space since Lisp objects may move during garbage collection. They are most useful for C structures created using the :malloc option.
- integer [integer...] datatype again, datatype is any valid (possibly compound) datatype, which may include the pointer *. The integers denote an array of the indicated dimensions. The accessor function(s) will accept appropriate subscript argument(s). The subscript arguments follow the C structure argument.
- slot [slot ...] cstructs may include other cstructs. Here slot is recursively defined as another list. This is similar to including another cstruct by name.

See ftype.htm for information on foreign types in Allegro CL and foreign-functions.htm for general information on foreign functions in Allegro CL.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version