Skip to content
Bruce Mitchener edited this page Jun 30, 2013 · 13 revisions

There is the start of an Objective-C bridge available.

Notably, it lacks support for objc_msgSend.

We need a design for how this should work, preferably informed by other implementations. Some Common Lisp implementations have Objective-C bridges and may be a good place to look.

In Dylan, this may require some compiler support, similar to direct-c-ffi or the higher level c-ffi.

Some sources of information about the Objective-C run-time and other bridges to it:

Message Invocation

To support objc_msgSend invocations properly, we will probably need a compiler extension similar to %call-c-function, with the corresponding support in DFMC.

BridgeSupport

We should be able to have melange read in BridgeSupport files and generate the appropriate bindings as defined in interface files like we do for C APIs.

Associated Objects

The Objective-C 2.0 run-time supports associating objects via objc_getAssociatedObject, objc_setAssociatedObject and friends. We need to provide a binding for this as well. This probably will relate to also supporting subclassing.

Subclassing and New Methods

The Objective-C 2.0 run-time provides enough support to allow Dylan programs to create new subclasses of Objective-C classes as well as to expose new method implementations.

Optimizing to use objc_msgSend_vtable

We will need compiler support to do this correctly, but some invocations of objc_msgSend could, in fact, become invocations of the objc_msgSend_vtable* functions. The code generated should actually be using objc_msgSend_fixup in this situation to enable this optimization within the Objective C run-time.

For details, see [objc-explain]: objc_msgSend_vtable by Greg Parker.

Clone this wiki locally