From: EL
Subject: Does Common Lisp have a C interface?
Date: 
Message-ID: <fmq32r$8nq$02$1@news.t-online.com>
Hello,

I am not a lisper - and just curious about the language, because it 
comes with quite a few concepts that are really nice...

But one question, because this would be a knockout criteria for me to 
dive deeper into Lisp (if I had the time and need for that diving):
Does CL or one of it's implementations have a C interface, so that one 
could integrate number crunching libraries and other neat stuff that is 
written in C?

Thanks in advance
E.

From: Ken Tilton
Subject: Re: Does Common Lisp have a C interface?
Date: 
Message-ID: <47906945$0$9122$607ed4bc@cv.net>
Peter Hildebrandt wrote:
> On Fri, 18 Jan 2008 13:16:05 +0100, EL <·············@gmx.de> wrote:
> 
>> CFFI and UFFI look good. Does anybody have experience with them - how  
>> (easy) is type conversion - e.g. C structures <-> CL types & how is 
>> the  overall handling? Which one is more recomendable?
> 
> 
> I would recommend CFFI.  It supports all major implementations.  C  
> structs, types, callbacks and the like are handled quite nicely ("in a  
> lispy fashion" if you will:  slot-value becomes foreign-slot-value 
> etc.).   The online doc is very good.
> 
> I have some experience with CFFI and I like it, but probably you'll 
> find  enough people who will say the same for UFFI.

No, CFFI is basically a step beyond UFFI, functionally the next 
generation and covering more Lisps, all Lisps for all intents and 
purposes. Implementationally...
> 
>> Or are the implementation specific interfaces better yet?
> 
> 
> AFAIK CFFI is basically a common wrapper around the implementation  
> specific interfaces.

...in some case CFFI wraps the implementation FFI as does UFFI, in other 
cases it digs a little deeper. I never actually looked very hard at the 
mechanics, but I think the CFFI page offers some deets.

kt

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

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Luís Oliveira
Subject: Re: Does Common Lisp have a C interface?
Date: 
Message-ID: <m1sl0s8x5a.fsf@deadspam.com>
EL <·············@gmx.de> writes:
> CFFI and UFFI look good. Does anybody have experience with them - how
> (easy) is type conversion - e.g. C structures <-> CL types & how is
> the overall handling? Which one is more recomendable?

CFFI's documentation includes a nice tutorial written by Stephen Compall
that might address many of your questions.  Quoting the first paragraph:

  “Users of many popular languages bearing semantic similarity to Lisp,
  such as Perl and Python, are accustomed to having access to popular C
  libraries, such as GTK, by way of “bindings”. In Lisp, we do something
  similar, but take a fundamentally different approach. This tutorial
  first explains this difference, then explains how you can use CFFI, a
  powerful system for calling out to C and C++ and access C data from
  many Common Lisp implementations.”

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

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/