[Openmcl-devel] programmatic file chooser? thanks!
Brent Fulgham
bfulgham at gmail.com
Fri Aug 29 10:33:34 PDT 2008
Samantha,
The thing I like about the Clozure FFI is that the creation of the
stubs are automated. So, unlike CFFI (and perhaps UFFI) where you are
required to write wrapper functions defining the input types and
return values for functions:
(cffi:defcfun ("ccl_chol_decomp_front" ccl-chol-decomp-front)
:int (x :pointer) (y :long) (z :pointer))
(defun chol-decomp-front (x y z)
(ccl-chol-decomp-front x y z))
CL-USER> (chol-decomp-front #2A((2 3 4) (1 2 4) (2 4 5)) 3 3)
... does stuff ...
Instead, the Clozure FFI produces a linking database based on parsing
the header files of any C/Objective C library, so if the corresponding
C library in the above example had been processed by the 'ffigen'
utility, I could then just do the following:
[... no declarations made, just load the library ...]
CL-USER> (#_chol-decomp-front #2A((2 3 4) (1 2 4) (2 4 5)) 3 3)
... does same stuff ...
So, I like the fact that I don't have to write and maintain C->Lisp<-C
wrapper functions. Even if something like SWIG is able to produce the
output, it still
On Thu, Aug 28, 2008 at 4:39 PM, Samantha Atkins <sjatkins at mac.com> wrote:
>
> On Aug 28, 2008, at 4:22 PM, Brent Fulgham wrote:
>
>
> On Thu, Aug 28, 2008 at 3:18 AM, Gary Byers <gb at clozure.com> wrote:
>>
>> I suspect (I don't know for sure) that the thing that'd help most
>> people the most in getting up to speed with using Cocoa in CCL is
>> comfort and familiarity with CCL's FFI. If that's true (and to the
>> extent that it is), it's somewhat unfortunate; when he first started
>> working on it, Randall Beer said that ideally he'd like the bridge to
>> expose as much of Cocoa as possible while hiding as much of ObjC as
>> possible. It's gotten closer to that goal over the years, but I
>> suspect that a lot of things that people have trouble with could
>> be blamed on the fact that ObjC (and some of the arcana of dealing
>> with it) still isn't hidden well enough.
>
> Of all the language embeddings/FFI's I've worked with, I think that Clozure CL's
> implementation is the easiest I've worked with. When getting started on the
> Open Agent Engine port, it was pretty amazing how simple (and straightforward)
> it was to translate a snippet of Objective C code from Apple's documentation
> into something that would work in CCL.
> The only 'complaint' or suggestion I would have regarding the FFI would be to
> make it easier to generate the CDB files. This is generally easy, but in some
> cases (especially with the release of Leopard with the new ObjC 2.0 syntax)
> it requires some clever declarations to ignore various things that Lisp doesn't
> care about.
> Perhaps you ship the FFI generator with Clozure; previously this had to be
> obtained from Gary or others (perhaps a valid first step in embarking on the
> journey of accessing foreign data -- you will probably be chatting with Gary at some
> point!)
> I wish other Lisp's had Clozure's FFI facilities. Well, actually I don't really care
> since I don't use them. ;-P
>
> Well I do use them, especially sbcl. What is so different about the Clozure FFI than say UFFI or other efforts? Since this is Open Source is there an effort to make this FFI, if that superior, available to other Lisps?
> - samantha
More information about the Openmcl-devel
mailing list