[Openmcl-devel] FFIGEN for Darwin

Gary Byers gb at clozure.com
Sun Feb 24 23:41:31 PST 2002



On Mon, 25 Feb 2002, Brian Campbell wrote:

> It's mentioned on the web page that patches for FFIGEN on Darwin
> would be released soon. Is there any progress on that? Or is
> there any way to write the FFI information by hand? I only need
> to call a fairly limited number of C functions, so writing the
> FFI files by hand wouldn't be too bad. The problem is, the two
> FFIGEN pages referenced from the OpenMCL page have conflicting
> definitions of the format of the FFI files, so I don't know what
> format I would have to write it in. Or, are there any versions
> of the Darwin interface database that include objc/objc-
> runtime.h? If you can get that working, you can use all of the
> AppKit and Foundation libraries available on MacOS X.
>
>

There's been a lot of progress with that.

Unfortunately, I'm moving in the next few days; I haven't been able to
package things up (and may not be able to for another few weeks.)
(Most of the changes to the lisp itself are in CVS; the "ffigen"
program is a patched version of gcc, and I still have to organize the
patches.)

Since Objective C is a superset of C, the Darwin version of ffigen
uses the objc-aware version of the gcc frontend.

A lot of the Carbon and Cocoa headers contains definitions that are
bracketed by:

#pragma options align=mac68k

C compiler directives (e.g., mis-align things to maintain binary
compatibility with the 68K.) Welcome to the 21st century.  Both the C
side of the translator and the lisp side had to change to accomodate
this nonsense.

The translator's historically ignored case-sensitivity.  There are
some cases in the Cocoa headers where case matters (e.g, the type 'ID'
- defined in AIFF.h - isn't the same thing as the objc type 'id'), so
0.11 will introduce syntax for dealing with this (hopefully, it won't
be too horrible.)

I have some preliminary code to do objc runtime stuff.  The good news
is that (by faking some of the libraries into thinking that OpenMCL
was launched with a bundle) I can get a Cocoa window and menubar
(loaded from .nib files) to appear; the bad news is that I still don't
have lisp-friendly event handling working (it's either too slow or
seems to expose a bug which causes code that can't run to run ...)
Getting this far involved defining (in lisp) some Objective C classes
and methods, so that's kind of encouraging.

If anyone's interested in this code (it won't run in 0.10.1, but
hopefully the move will go smoothly and 0.11 will be out soon), it's
in CVS in

  ccl/examples/apple-objc.lisp
  ccl/examples/cocoa-window.lisp
  ccl/examples/cocoa.lisp

> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel
>
>


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list