All Manuals > Foreign Language Interface User Guide and Reference Manual > 8 Type Reference

:function FLI Type Descriptor

Summary

Converts between Lisp and the C function type.

Package

keyword

Syntax

:function &optional args-spec return-spec &key calling-convention

Arguments
args-spec
A list of foreign types.
return-spec
A foreign type.
calling-convention
A keyword naming the calling convention.
Description

The FLI type :function allows for conversion from the C function type. It is typically used in conjunction with the :pointer type to reference an existing foreign function.

args-spec and return-spec specify the argument types and return type respectively.

calling-convention is as described for define-foreign-function.

Examples

The following code lines present a definition of a pointer to a function type, and a corresponding C definition of the type. The function type is defined for a function which takes as its arguments an integer and a pointer to a void, and returns an integer value.

(:pointer (:function (:int (:pointer :void)) :int))
int (*)( int, void * )
See also

:pointer


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