From: Rupert Swarbrick
Subject: Bindings to C libraries
Date: 
Message-ID: <DkR6j.3091$1j1.601@newsfe7-gui.ntli.net>
Hi!

I was wondering whether there's a tutorial / introduction to creating 
bindings to C libraries for common lisp. I've never done this sort of 
thing before, but I've noticed existing packages I use using uffi and 
cffi.

Is this very nonstandard across platforms? I'm using sbcl on debian 
unstable at the moment.

Rupert

From: Zach Beane
Subject: Re: Bindings to C libraries
Date: 
Message-ID: <m3k5noezxm.fsf@unnamed.xach.com>
Rupert Swarbrick <··········@gmail.com> writes:

> Hi!
>
> I was wondering whether there's a tutorial / introduction to creating 
> bindings to C libraries for common lisp. I've never done this sort of 
> thing before, but I've noticed existing packages I use using uffi and 
> cffi.
>
> Is this very nonstandard across platforms? I'm using sbcl on debian 
> unstable at the moment.

CFFI and UFFI are portability systems for Common Lisp FFI. CFFI is
newer. CFFI has a tutorial here:

  http://common-lisp.net/project/cffi/manual/html_node/Tutorial.html

Zach
From: Rupert Swarbrick
Subject: Re: Bindings to C libraries
Date: 
Message-ID: <qiU6j.3135$1j1.2464@newsfe7-gui.ntli.net>
On Sun, 09 Dec 2007 08:54:29 -0500, Zach Beane wrote:
> CFFI and UFFI are portability systems for Common Lisp FFI. CFFI is
> newer. CFFI has a tutorial here:
> 
>   http://common-lisp.net/project/cffi/manual/html_node/Tutorial.html
> 
> Zach

Thank you very much for the answers! I should have carried on digging for 
another 20 minutes! The cffi docs look much friendlier, so I think I'll 
go with that.

Now off to get something working...

Rupert
From: Joost Diepenmaat
Subject: Re: Bindings to C libraries
Date: 
Message-ID: <475be659$0$24367$e4fe514c@dreader17.news.xs4all.nl>
On Sun, 09 Dec 2007 12:37:55 +0000, Rupert Swarbrick wrote:

> Hi!
> 
> I was wondering whether there's a tutorial / introduction to creating
> bindings to C libraries for common lisp. I've never done this sort of
> thing before, but I've noticed existing packages I use using uffi and
> cffi.
> 
> Is this very nonstandard across platforms? I'm using sbcl on debian
> unstable at the moment.

Both cffi and uffi are portable across platforms, but I don't think 
either of them is portable across _all_ current platforms. See the docs.

I'm using cffi to interface with a few libraries at the moment, and I 
think it's pretty easy to use. Uffi looks similar, but I haven't used it 
myself. I'd done some C programming and extension building for other 
languages before I started on lisp, and I guess that taints my estimate 
of how easy cffi is (it is much easier than Perl/XS when you're dealing 
with a simple API, for instance. On the other hand, Perl/XS makes it easy 
to add glue on the C-side of the interface, while cffi does nothing like 
that.

As for the tutorial, did you see this?
http://common-lisp.net/project/cffi/manual/html_node/Tutorial.html

Joost.
From: Ken Tilton
Subject: Re: Bindings to C libraries
Date: 
Message-ID: <475bff27$0$32093$607ed4bc@cv.net>
Joost Diepenmaat wrote:
> On Sun, 09 Dec 2007 12:37:55 +0000, Rupert Swarbrick wrote:
> 
> 
>>Hi!
>>
>>I was wondering whether there's a tutorial / introduction to creating
>>bindings to C libraries for common lisp. I've never done this sort of
>>thing before, but I've noticed existing packages I use using uffi and
>>cffi.
>>
>>Is this very nonstandard across platforms? I'm using sbcl on debian
>>unstable at the moment.
> 
> 
> Both cffi and uffi are portable across platforms, but I don't think 
> either of them is portable across _all_ current platforms.

CFFI is, for any reasonable value of _all_.

kt

-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius