Objective-C is a C-like object-oriented programming language that is used on macOS to implement the Cocoa API. The LispWorks Objective-C interface is an extension to the interface described in the Foreign Language Interface User Guide and Reference Manual to support calling Objective-C methods and also to provide defining forms for Objective-C classes and methods implemented in Lisp. This manual assumes that you are familiar with the LispWorks FLI, the Objective-C language and the Cocoa API where appropriate, and it uses the same notation and conventions as the Foreign Language Interface User Guide and Reference Manual.
Note: the LispWorks Objective-C interface is only available on the Macintosh.
The remainder of this chapter describes the LispWorks Objective-C interface, which is generally used in conjunction with the Cocoa API (see 3 The Cocoa Interface). Examples in this chapter assume that the current package uses the objc
package.
Before calling any of the Objective-C interface functions, the runtime system must be initialized. This is done by calling ensure-objc-initialized, optionally passing a list of foreign modules to be loaded. For example, the following will initialize and load Cocoa:
(objc:ensure-objc-initialized :modules '("/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation" "/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa"))
LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 01 Dec 2021 19:38:32