[Openmcl-devel] New interface translator for Leopard (especially)

Gary Byers gb at clozure.com
Tue Nov 6 15:08:14 PST 2007



On Tue, 6 Nov 2007, Ron Garret wrote:

> Is there an easy way to use ffigen to import other (non-Apple) libraries? 
> (I'm specifically thinking of libmysql.)
>
> I tried the obvious thing:
>
> h-to-ffi.sh /usr/local/mysql/include/mysql.h
>
> but that didn't seem to do anything (though reverse-engineering one of the 
> populate.sh scripts sure makes it look like it should have).

I think that it should have created

./usr/local/mysql/include/mysql.ffi  # in current directory

whose contents are lispy equivalents of the stuff defined in the .h
file.  (If it didn't do this and it ran to completion without error,
I'm not sure what it would have done.)

The populate.sh scripts don't do too much more than call h-to-ffi.sh
one or more times.  They might clean up the local directories that're
created (./usr, ./System, ./Developer, etc.) so that you don't
get older stuff mixed in with the new, and in some cases they
allow things like setting a different SDK (in OSX/XCode) and
providing a way to predefine CFLAGS.  In the case of C (vs ObjC)
code, the "-m64" option is probably the only one that matters (it
means "generate 64-bit code", which means "follow 64-bit conventions
when laying out/aligning structures and in a few other cases."  You
very likely need to say "-m64", since the 32-bit results wouldn't
be useful to a 64-bit lisp.

The directory structure (darwin-x86-headers64/*/C) does matter
to other things that use the .ffi files and the .cdb files built
from them, and CREATE-INTERFACES expects there to be a "populate.sh"
script in the "standard" place.

>
> rg
>
> On Nov 6, 2007, at 12:29 AM, Gary Byers wrote:
>
>> I was able to use Apple's recent gcc-5465 (the version that ships with
>> Leopard/XCode 3.0) sources to generate a new version of the FFI translator
>> (ffigen); this seems to do a better job of translating the Leopard headers
>> for Cocoa and other ObjC (2.0) frameworks than the half-complete version
>> that I'd been using did.
>> 
>> The "sources" (a bunch of patches to Apple's gcc-5465 and a Makefile
>> that applies them, builds the translator, and pacakges it up) is
>> available at:
>> 
>> <ftp://clozure.com/pub/testin/ffigen-for-apple-gcc-5465-src.tar.gz>
>> 
>> If you untar that archive, cd to the "ffigen-for-apple-gcc-5465"
>> directory that it contains, and type "make", it'll tell you that
>> you need Apple's gcc-5465 tarball (and it'll tell you where to find
>> it.)
>> 
>> <ftp://clozure.com/pub/testing/ffigen-apple-gcc-5465-x86-64-2007-11-06-00-00-59.tar.gz>
>> 
>> is the result of building that on an x86-64 Tiger system; that executable
>> should run on x86[-64] versions of Tiger and Leopard and seems able to
>> handle all of the constructs found in the Leopard headers.
>> 
>> (There should be a README file that explains how to install the binary
>> archive; the idea is to install the archive in a directory that has
>> a ./bin directory that's on your shell's search path, e.g, if 
>> /usr/local/bin
>> is on $PATH, then extracting the archive in /usr/local would work.)
>> 
>> I've checked in some "populate.sh" scripts for some things that've
>> been missing (webkit, addressbook, quartz, quartzcore, qtkit ...)
>> 
>> (I haven't yet done anything with this for the PPC. That obviously
>> -should- be done, but since there are some missing bits in the ObjC
>> bridge for ppc64 and the ppc32 Tiger interfaces should work on both
>> Tiger and (that subset of Tiger shared by) Leopard), it seems a bit
>> less critical.
>> 
>> 
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://clozure.com/mailman/listinfo/openmcl-devel
>



More information about the Openmcl-devel mailing list