All Manuals > Foreign Language Interface User Guide and Reference Manual > 7 Function, Macro and Variable Reference

define-foreign-pointer Macro

Summary

Defines a new FLI pointer type.

Package

fli

Signature

define-foreign-pointer name-and-options points-to-type &rest slots => type-name

name-and-options ::= type-name | (type-name (option*))

option ::= (option-name option-value)

Arguments
points-to-type
A foreign type.
slots
Slots of the new type.
type-name
A symbol naming the new FLI type.
option-name
:allow-null or a defstruct option.
option-value
A symbol.
Values
type-name
The name of the new FLI pointer type.
Description

The macro define-foreign-pointer defines two things:

The option :allow-null takes an option-value of either t or nil, defaulting to nil. It controls whether the type type-name accepts nil.

The other allowed values for option-name are the defstruct options :conc-name, :constructor, :predicate, :print-object, :print-function. In each case the symbol supplied as option-value provides the corresponding option for type-name.

slots is a list of defstruct slot-descriptions which become slots in type-name.

When LispWorks makes a foreign pointer of type type-name, then an object of Lisp type type-name is made instead of a foreign pointer object. This is useful if you want to associate extra Lisp data with the foreign pointer object, using slots.

See also

3.1.1 Creating pointers


Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:34:58