NextPrevUpTopContentsIndex

define-foreign-type

Macro
Summary

Defines a new FLI type specifier.

Package

fli

Signature

define-foreign-type name-and-options lambda-list &body forms => name

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

option ::= (:foreign-name string )

Arguments

name

A symbol naming the new FLI type

string

A string specifying the foreign name of the type

lambda-list

A lambda list which is the argument list of the new FLI type

forms

One or more Lisp forms which provide a definition of the new type

Values

name

The name of the new FLI type

Description

The macro define-foreign-type defines a new FLI type called name . The forms in the definition can be used to determine the behavior of the type, depending on the arguments supplied to the lambda-list .

Example

In the following example an integer array type specifier is defined. Note that the type takes a list as its argument, and uses this to determine the size of the array.

(fli:define-foreign-type :int-array (dimensions)
  `(:c-array :int ,@dimensions))
(setq number-array (fli:allocate-foreign-object
                    :type '(:int-array (2 2))))

In the next example a boolean type, called :bool , with the same size as an integer is defined.

(fli:define-foreign-type :bool () `(:boolean :int)) (fli:size-of :bool)
See also

define-c-typedef
define-foreign-forward-reference-type
foreign-type-equal-p


LispWorks Foreign Language Interface User Guide and Reference Manual - 14 Mar 2008

NextPrevUpTopContentsIndex