Next Previous Up Top Contents Index

5 Function and Macro Reference

define-c-union

Macro

Summary

Defines an FLI union type corresponding to the Cunion type.
Package

fli

Signature

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

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

Arguments

name

The name of the new union type descriptor.

slot-descriptions

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

slot-name

A symbol naming the slot.

slot-type

The FLI type of the slot.

Values

list

The list(:unionname).

Description

The macrodefine-c-union is used to define an FLI union type specifier, which corresponds to the Cunion type. It is a convenience function, as a union type could also be defined usingdefine-foreign-type.
A union is an aggregate type, or collection, of other FLI types. The types contained in a union are referred to as slots, and can be accessed using theforeign-slot-type andforeign-slot-value functions.
Example

In the following example a union is defined usingdefine-c-union, and the corresponding C code is given.
(fli:define-c-union a-point (x :int)
                            (color :byte)
                            (ident :char))

union a-point { int x; byte color; char ident; };

See Also

define-c-enum
define-c-struct
define-c-typedef
define-foreign-type

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker