[Openmcl-devel] Using Cocoa with MCL
yversley at gmx.de
Fri May 9 14:35:01 EDT 2003
The GnuStep ObjC-Java wrapper does the same thing as the one from Apple
and you can look into the source how they do certain things.
It's called JIGS (Java Interface to GnuStep) and can be found at
If I remember right, things are done in the following fashion:
- Strings (and possibly other objects) are converted to ObjC/Java
native types, other objects are wrapped into some kind of proxy object
(and are unwrapped again if they pass the boundary in the other
Since the ObjC stuff is pretty generic, you can use (at least with the
apple version) methods from java classes ObjC doesn't know about, while
the opposite isn't true.
I don't know if it would be sensible to have a ObjC wrapper class for
Lisp objects which tries to look for a matching generic function when
a selector is invoked. Having a generic function metaobject that tries
to invoke an ObjC selector on ObjC objects if it cannot find a matching
Lisp method implementation is an interesting idea, though.
- These wrapper objects "retain" their counterparts on the other side
(either via JNI Add/DeleteGlobalRef and ObjC retain/release).
This leads to nasty behaviour when there is a lot of mixing between
ObjC and Java objects, since freeing only occurs after multiple
invocations of the GC (first Java object is finalized, releases ObjC
object, which DeleteGlobalRef's the next Java object etc.)
- Exceptions are caught and rethrown as native exceptions on the Java/ObjC
and ObjC/Java boundaries. This isn't very helpful when you have nested
calls between ObjC and Java, because you then only get a Java exception
that comes from an ObjC exception that was thrown because of a Java
exception you don't see.
OpenMCL currently cannot handle ObjC exceptions, and this seems to be
hard to do on the lisp side since _setjmp() does nothing useful when
invoked from lisp. This is sad because as of 13.4, ObjC exceptions
invoke some trap that is deep inside Stuff You Don't Want To Know About
and does nothing useful.
On Fri, 9 May 2003, Sven Van Caekenberghe wrote:
> I found the following docs on my Mac OS X system with dev tools:
> I didn't have time to read it though ;-)
> Also, have a look at the directories /Developer/Java/Jobs and
> /Developer/Java/Headers, this is part of there autogeneration stuff, I
Openmcl-devel mailing list
Openmcl-devel at clozure.com
More information about the Openmcl-devel