All Manuals > LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual > 1 Introduction to the Objective-C Interface

1.2 Objective-C data types

The Objective-C interface uses types in the same way as the LispWorks FLI, with a restricted set of FLI types being used to describe method arguments and results. Some types perform special conversions to hide the FLI details (see 1.3.3 Special argument and result conversion and 1.4.3.1 Special method argument and result conversion).

1.2.1 Objective-C pointers and pointer types

Objective-C defines its own memory management, so most interaction with its objects occurs using foreign pointers with the FLI type descriptor objc-object-pointer. When an Objective-C object class is implemented in Lisp, there is an additional object of type standard-objc-object which is associated with the foreign pointer (see 1.4 Defining Objective-C classes and methods).

There are a few specific Objective-C pointer types that have a direct translation to FLI types:

Pointer types in Objective-C
Objective-C typeFLI type descriptor

Class

objc-class

SEL

sel

id

objc-object-pointer

char *

objc-c-string

Other pointer types are represented using the :pointer FLI type descriptor as normal.

When using pointers to struct types, the type must be defined using define-objc-struct rather than fli:define-c-struct.

1.2.2 Integer and boolean types

The various integer types in Objective-C have corresponding standard FLI types. In addition, the Objective-C type BOOL, which is an integer type with values NO and YES, has a corresponding FLI type objc-bool with values nil and t.

1.2.3 Structure types

Structures in Objective-C are like structures in the FLI, but are restricted to using other Objective-C types for the slots. The macro define-objc-struct must be used to define a structure type that is suitable for use as an Objective-C type.


LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 01 Dec 2021 19:38:32