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

:boolean FLI Type Descriptor

Summary

Converts between a Lisp boolean value and a C representation of a boolean value as an integer.

Package

keyword

Syntax

:boolean &optional encapsulates

Arguments
encapsulates
An integral type or :standard.
Description

The FLI type :boolean converts between a Lisp boolean value and a C representation of a boolean value. encapsulates specifies the size of the value from which the boolean value is obtained. For example, if a signed char is used in C to represent a boolean, the size to map across for the FLI will be one byte, but if an int is used, then the size will be four bytes. If encapsulates is :standard, then the type maps to the _Bool type in the C99 language definition.

A value of 0 in C represents a nil boolean value in Lisp, and a non-zero value in C represents a t boolean value in Lisp.

Compatibility Note

Prior to LispWorks 8.1, you could omit encapsulates and it would default to :int, but this caused subtle bugs if the API expected a different size of integer. In LispWorks 8.1 and later, a warning is signalled if you omit encapsulates and you should check the API's documentation to decide the correct size of integer to specify, or use :bool or :int-boolean if appropriate.

Examples

In the following two examples, the size of a (:boolean :int) and a (:boolean :byte) are returned.

(fli:size-of '(:boolean :int))
 
(fli:size-of '(:boolean :byte))
See also

:bool
:int-boolean
size-of
2.1.5 Boolean types


Foreign Language Interface User Guide and Reference Manual - 18 Feb 2025 15:36:34