Next Previous Up Top Contents Index

6 Type Reference

:struct

FLI type descriptor

Summary

Converts between a Lisp object and a Cstruct.
Package

fli

Syntax

:struct &rest slots

slots ::= {symbol | (symbol type)}*

Arguments

slots

A sequence of one or more slots making up the structure.

symbol

A symbol naming the slot.

type

The slot type. If no type is given it defaults to an:int.

Description

The FLI:struct type is an aggregate type, and converts between a Lisp object and a Cstruct type. The FLI structure consists of a collection of one or more slots. Each slot has a name and a type.
The foreign-slot-names, foreign-slot-type, and foreign-slot-value functions can be used to access and change the slots of the structure. The convenience FLI function define-c-struct is provided to simplify the definition of structures.
Example

In the following example a structure for passing coordinates to Windows functions is defined.
(fli:define-c-struct tagPOINT (x :long) (y :long))

An instance of the structure is allocated and bound to the Lisp variableplace.
(setq place 
      (fli:allocate-foreign-object :type 'tagPOINT))

Finally, thex slot ofplace is set to be4 usingfli:foreign-slot-value.
(seft (fli:foreign-slot-value place 'x) 4)

See Also

define-c-struct
foreign-slot-names
foreign-slot-offset
foreign-slot-pointer
foreign-slot-type
foreign-slot-value

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker