LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual > 1 Introduction to the Objective-C Interface > 1.3 Invoking Objective-C methods

NextPrevUpTopContentsIndex

1.3.1 Simple calls to instance and class methods

The function invoke is used to call most methods (but see Invoking a method that returns a boolean, Invoking a method that returns a structure and Invoking a method that returns a string or array for ways of calling more complex methods). This function has two required arguments:

The remaining arguments are passed to the method in the specified order. See Special argument and result conversion for information about how the arguments are converted to FLI values.

For example, a call in Objective-C such as:

[window close]

would be written using invoke as:

(invoke window "close")

In addition, invoke can be used to call class methods for specifically named classes. This is done by passing a string naming the Objective-C class instead of the object.

For example, a class method call in Objective-C such as:

[NSObject alloc]

would be written using invoke as:

(invoke "NSObject" "alloc")
LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex