The immediate types are the basic types used by the FLI to convert between Lisp and a foreign language.
The immediate types of the FLI are :boolean, :byte, :char, :const, :double, :enum, :float, :int, :lisp-double-float, :lisp-float, :lisp-single-float, :long, :pointer, :short, :signed and :unsigned. For details on each immediate type, see the relevant reference entry.
Integral types are the FLI types that represent integers. They consist of the following: :int, :byte, :long, :short, :signed, :unsigned and :enum, along with integer types converting to types with particular sizes defined by ISO C99 such as :int8, :uint64 and :intmax.
Integral types can be combined in a list for readability and compatibility purposes with the foreign language, although when translated to Lisp such combinations are usually returned as a Lisp
integer, or a
fixnum for byte sized combinations. For example, a C
unsigned long can be represented in the FLI as an
The FLI provides several different immediate types for the representation of floating point numbers. They consist of the following: :float, :double, :lisp-double-float, :lisp-float, and :lisp-single-float. The floating types all associate equivalent Lisp and C types, except the :lisp-float, which can take a modifier to cause an association between different floating types. A :lisp-float associates a Lisp
float with a C
float by default, but a declaration of
(:lisp-float :double) corresponds to a C
double, for example.
Note: be sure to use
:language :ansi-c when passing float arguments to and from C using define-foreign-function and so on.
The FLI provides the :char type to interface a Lisp
character with a C
The FLI provides the :boolean type to interface a Lisp boolean value (
nil) with a C
int (0 corresponding to
nil, and any other value corresponding to
:boolean type can be modified to make it correspond with other C types. For example,
(:boolean :byte) would associate a Lisp boolean with a C
(:boolean :long) would associate a Lisp boolean with a C
LispWorks Foreign Language Interface User Guide and Reference Manual - 29 Sep 2017