-
Notifications
You must be signed in to change notification settings - Fork 69
Objective C Bridge
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:
- Understanding the Objective-C Runtime
- Objective-C Runtime Programming Guide
- Objective-C Runtime Reference
- Clozure CL's Objective C Bridge
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.
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.
The Objective C 2.0 runtime provides enough support to allow Dylan programs to create new subclasses of Objective C classes as well as to expose new method implementations.
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.