From: '
Subject: Implementations of C function interface?
Date: 
Message-ID: <45b780c3.0301171007.6d2adb6@posting.google.com>
I am looking for implementations (in C or Lisp) of interfaces to let
Lisp call C code.  I am primarily interested in calling library
functions.  It would also be really nice to be able to read
declarations from standard C #include files since handcrafting each
individual foreign function declaration is inconvenient. 
Implementations for any Lisp dialect such as Common Lisp, Scheme, or
Emacs Lisp are acceptable.

Thanks,
Adam

From: Barry Margolin
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <nqYV9.26$f83.410@paloalto-snr1.gtei.net>
In article <···························@posting.google.com>,
' <········@yahoo.com> wrote:
>I am looking for implementations (in C or Lisp) of interfaces to let
>Lisp call C code.

Most Lisp implementations include something called "Foreign Function
Interface", which allows calling between Lisp and other languages.  It's
not standardized, so you must look in the documentation of your particular
implementation to see how it's done.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Jens Axel S�gaard
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <3e285bb4$0$71656$edfadb0f@dread11.news.tele.dk>
Barry Margolin wrote:
> In article <···························@posting.google.com>,
> ' <········@yahoo.com> wrote:
>> I am looking for implementations (in C or Lisp) of interfaces to let
>> Lisp call C code.

Lars Hansen has some interesting things to say:

http://www.ccs.neu.edu/home/lth/ffigen/index.html

Furthermore the CVS version of SWIG now supports 3 different Schemes,
and a plethora of other languages.

--
Jens Axel S�gaard
From: '
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <45b780c3.0301171546.f7bef0@posting.google.com>
"Jens Axel S gaard" <······@soegaard.net> wrote in message news:<·························@dread11.news.tele.dk>...

> Lars Hansen has some interesting things to say:
> 
> http://www.ccs.neu.edu/home/lth/ffigen/index.html

This looked pretty good until I checked out ...

> Furthermore the CVS version of SWIG now supports 3 different Schemes,
> and a plethora of other languages.

The link to this on the above page is broken.  But Google reveals 
http://www.swig.org/
Apparently this is much more advanced and undergoing active
development.  I will probably use this.

Thanks,
Adam
From: Marco Antoniotti
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <Y5_V9.39$V36.1627@typhoon.nyu.edu>
Jens Axel S�gaard wrote:

> Barry Margolin wrote:
>
> >In article <···························@posting.google.com>,
> >'  wrote:
> >
> >>I am looking for implementations (in C or Lisp) of interfaces to let
> >>Lisp call C code.
>
>
> Lars Hansen has some interesting things to say:
>
> http://www.ccs.neu.edu/home/lth/ffigen/index.html

FFIGEN seems useful.  How does it compare with C-PARSE?

>
> Furthermore the CVS version of SWIG now supports 3 different Schemes,
> and a plethora of other languages.


SWIG is interesting, but it seems kind of awkward to use.  Has anybody 
any direct experience with it?

Finally let's not forget the UFFI.

Cheers

Marco Antoniotti

>
From: Jens Axel S�gaard
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <3e29b614$0$71707$edfadb0f@dread11.news.tele.dk>
Marco Antoniotti wrote:

> FFIGEN seems useful.  How does it compare with C-PARSE?

I don't know C-parse.

>> Furthermore the CVS version of SWIG now supports 3 different Schemes,
>> and a plethora of other languages.
>
> SWIG is interesting, but it seems kind of awkward to use.  Has anybody
> any direct experience with it?

I used it to make simple bindings for ImageMagick for MzScheme. It took me a
while to get to work, but I mostly blame the ImageMagick source. The never-written
documentation for the mzscheme backend og SWIG didn't help either. I wrote down
some of the things I figured out at
    http://www.scheme.dk/imagemagick-for-mzscheme/
see the middle half.

--
Jens Axel S�gaard
From: Matthias Koeppe
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <uw5lm1gc6c7.fsf@lambda.math.uni-magdeburg.de>
Marco Antoniotti <·······@cs.nyu.edu> writes:

> Jens Axel S�gaard wrote:
>> Furthermore the CVS version of SWIG now supports 3 different Schemes,
>> and a plethora of other languages.
>
> SWIG is interesting, but it seems kind of awkward to use.  Has anybody
> any direct experience with it?

I maintain SWIG's Guile and MzScheme back-ends because I use SWIG in a
scientific application that is written in C and Scheme.  When one gets
used to SWIG, it can be quite convenient for projects with a "regular"
API because of SWIG's pattern-matching rules for converting data types
("typemaps").  It also seems to be good for wrapping C++ libraries,
but I can't comment on that since I don't do C++.

> Finally let's not forget the UFFI.

I have also recently added an back-end to SWIG that emits the
parse-tree as a large s-expression (with circularities).  It is
included with version 1.3.17.  A little CL program creates UFFI
declarations from this.  The whole thing is experimental and not at
all complete.

-- 
Matthias K�ppe -- http://www.math.uni-magdeburg.de/~mkoeppe
From: Ng Pheng Siong
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <b0i9g7$6qj$1@mawar.singnet.com.sg>
According to Marco Antoniotti  <·······@cs.nyu.edu>:
> SWIG is interesting, but it seems kind of awkward to use.  Has anybody 
> any direct experience with it?

Yes. ;-)

It is kind of awkward to use. For a while they were talking about exposing
SWIG to scripting, i.e., swigging SWIG itself so one could use one's
favourite scripting language to drive it, but I don't know what came of it.

It is also a fairly fast-moving target. My SWIG-based crypto/SSL bindings
for Python (the language) can barely keep up with its sometimes gratuitous
changes.


-- 
Ng Pheng Siong <····@netmemetic.com> * http://www.netmemetic.com
From: Sam Steingold
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <m3k7h34jl8.fsf@loiso.podval.org>
> * In message <···························@posting.google.com>
> * On the subject of "Implementations of C function interface?"
> * Sent on 17 Jan 2003 10:07:18 -0800
> * Honorable ········@yahoo.com (') writes:
>
> I am looking for implementations (in C or Lisp) of interfaces to let
> Lisp call C code.

<http://clisp.cons.org/impnotes/dffi.html>


-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
PI seconds is a nanocentury
From: Helmut Eller
Subject: Re: Implementations of C function interface?
Date: 
Message-ID: <m2bs2extrn.fsf@stud3.tuwien.ac.at>
········@yahoo.com (') writes:

>	      It would also be really nice to be able to read
> declarations from standard C #include files since handcrafting each
> individual foreign function declaration is inconvenient. 

Have a look at Gary Byers' patch for gcc: 

http://openmcl.clozure.com/Doc/interface-translation.html

The modified gcc emits C type declarations as s-expressions.  You have
do to some post processing to make them usable for your
implementation.  Also look at the parse-ffi.lisp file in the OpenMCL
sources for some code to convert C macros to Lisp macros.

hth,
helmut.