From: Steve
Subject: Calling lisp from C
Date: 
Message-ID: <slrndpkbqa.60g.fishing@nowhere.example.com>
What is the easiest way to call lisp from C? The various FFI packages I
looked at seemed more concerned with calling C from lisp. I'm familiar
with CORBA but couldn't find a good free implementation. In the end I just
sent and received s-expressions over a local socket as that seemed
easiest. I've done a lot of network programming though so I didn't know if
this was a case of having a hammer and seeing every problem as a nail.

Did I miss something obvious?

From: Surendra Singhi
Subject: Re: Calling lisp from C
Date: 
Message-ID: <fyp1xvpz.fsf@netscape.net>
Steve <·······@nowhere.example.com> writes:

> What is the easiest way to call lisp from C? The various FFI packages I
> looked at seemed more concerned with calling C from lisp. I'm familiar
> with CORBA but couldn't find a good free implementation. In the end I just
> sent and received s-expressions over a local socket as that seemed
> easiest. I've done a lot of network programming though so I didn't know if
> this was a case of having a hammer and seeing every problem as a nail.

Look at clisp FFI, it provides an easy way if calling lisp from C. I think
ffi of other implementations also provide this facility. It is called
`callback'. You might also want to check out cffi.

-- 
Surendra Singhi
http://www.public.asu.edu/~sksinghi/index.html

,----
| Great wits are sure to madness near allied,
| And thin partitions do their bounds divide.
| 
|     (John Dryden, Absalom and Achitophel, 1681)
`----
From: Pascal Costanza
Subject: Re: Calling lisp from C
Date: 
Message-ID: <3vviimF174ib6U1@individual.net>
Steve wrote:
> What is the easiest way to call lisp from C? The various FFI packages I
> looked at seemed more concerned with calling C from lisp. I'm familiar
> with CORBA but couldn't find a good free implementation.

See http://www.cliki.net/CORBA

> In the end I just
> sent and received s-expressions over a local socket as that seemed
> easiest. I've done a lot of network programming though so I didn't know if
> this was a case of having a hammer and seeing every problem as a nail.
> 
> Did I miss something obvious?

ECL is an embeddable Common Lisp. See also 
http://wiki.alu.org:80/Implementation for a list of more Common Lisp 
implementations.


Pascal

-- 
My website: http://p-cos.net
Closer to MOP & ContextL:
http://common-lisp.net/project/closer/
From: Barry Wilkes
Subject: Re: Calling lisp from C
Date: 
Message-ID: <1134211333.810053.200480@g44g2000cwa.googlegroups.com>
Steve wrote:
> What is the easiest way to call lisp from C? The various FFI packages I
> looked at seemed more concerned with calling C from lisp. I'm familiar
> with CORBA but couldn't find a good free implementation.

If you are on windows and using Lispworks, you can deliver a dll which
you can link into your C application.  I've used this approach with
success in my own applications.

Barry.
From: Michael
Subject: Re: Calling lisp from C
Date: 
Message-ID: <slrndpm8mt.4au.malus42@yahoo.com>
On 2005-12-10, Pascal Costanza <··@p-cos.net> wrote:
>  See http://www.cliki.net/CORBA

Thanks for the pointer. I'll check it out.

>  ECL is an embeddable Common Lisp. See also 
>  http://wiki.alu.org:80/Implementation for a list of more Common Lisp 
>  implementations.

I looked at it long enough to see that it was currently broken on OS X and
then I stopped looking :)

Thanks for the help.
From: Juanjo
Subject: Re: Calling lisp from C
Date: 
Message-ID: <1134392852.928533.203940@g14g2000cwa.googlegroups.com>
Michael schrieb:
> On 2005-12-10, Pascal Costanza <··@p-cos.net> wrote:
> >  ECL is an embeddable Common Lisp. See also
> >  http://wiki.alu.org:80/Implementation for a list of more Common Lisp
> >  implementations.
>
> I looked at it long enough to see that it was currently broken on OS X and
> then I stopped looking :)

[Sorry if you get this as a dupo, but I sent this yesterday via Google
and has not appeared yet]

I would like to know in what sense the OS X port is broken. I have
finished building ECL half an hour ago and it is working perfectly on
my iBook. I even built the 0.9h release before and I do test the CVS
version regularly.

If you experienced some problem is most likely due to some temporary
instability of the CVS sources, or some bug that will definitely be
present in other platforms, or because of using some experimental
configuration flags, such as --enable-threads or --with-__thread.
Hence, as a developer of ECL I would like to know. Feel free to submit
a log of the process, or send a core file to my private email address
or just tell us what configuration you used.

Anything is better than just a silence. For a free project it is
impossible to test all configurations of machines / OS / compilers
/libraries around there, and failure to build or install the program
tells us, "hey, look at this, maybe you should try reproduce this
because it could be a bug in ECL".

Juanjo
From: Steve
Subject: Re: Calling lisp from C
Date: 
Message-ID: <slrndpqu5a.90f.fishing@nowhere.example.com>
On 2005-12-12, Juanjo <····@arrakis.es> wrote:
>  Michael schrieb:
> > On 2005-12-10, Pascal Costanza <··@p-cos.net> wrote:
> > >  ECL is an embeddable Common Lisp. See also
> > >  http://wiki.alu.org:80/Implementation for a list of more Common Lisp
> > >  implementations.
> >
> > I looked at it long enough to see that it was currently broken on OS X and
> > then I stopped looking :)
> 
>  [Sorry if you get this as a dupo, but I sent this yesterday via Google
>  and has not appeared yet]
> 
>  I would like to know in what sense the OS X port is broken.

To quote the front of the ECL homepage:

  "The port to OSX is broken due to some problems with the garbage
   collector and the latest versions of OSX."

>  Anything is better than just a silence. For a free project it is
>  impossible to test all configurations of machines / OS / compilers
>  /libraries around there, and failure to build or install the program
>  tells us, "hey, look at this, maybe you should try reproduce this
>  because it could be a bug in ECL".

I'm just believing the ECL developers themselves and their own
homepage. They are the ones that say its broken, not me :)
From: Juanjo
Subject: Re: Calling lisp from C
Date: 
Message-ID: <1134398821.853811.234640@g14g2000cwa.googlegroups.com>
Steve schrieb:
> On 2005-12-12, Juanjo <····@arrakis.es> wrote:
> >  I would like to know in what sense the OS X port is broken.
>
> To quote the front of the ECL homepage:
>
>   "The port to OSX is broken due to some problems with the garbage
>    collector and the latest versions of OSX."
>
> I'm just believing the ECL developers themselves and their own
> homepage. They are the ones that say its broken, not me :)

Well, developers may forget to update the webpage if they spend too
much time coding.

Actually, quoting the Cliky webpage on ECL: "Make sure you obtain CVS
sources, since the tarballs are not updated regularly. Don't believe
the web pages - they're not up-to-date." :-)

Also, if you dig in the mailing list you will find this:
http://ecls.sourceforge.net/status.html This webpage records successful
build and testing of ECL on different platform.

It is not very accurate, because cron jobs in Sourceforge keep failing
due to misconfiguration of machines, wrong email routing and other
stuff. Anybody who is willing to contribute a machine for regular
builds, is encouraged to do so.

Juanjo
From: mbstevens
Subject: Re: Calling lisp from C
Date: 
Message-ID: <w5Bmf.2563$Tg2.379@newsread1.news.pas.earthlink.net>
Steve wrote:
> What is the easiest way to call lisp from C? The various FFI packages I
> looked at seemed more concerned with calling C from lisp. I'm familiar
> with CORBA but couldn't find a good free implementation. In the end I just
> sent and received s-expressions over a local socket as that seemed
> easiest. I've done a lot of network programming though so I didn't know if
> this was a case of having a hammer and seeing every problem as a nail.
> 
> Did I miss something obvious?

Guile is the Gnu extension language for C.  It is just a library that 
holds a Scheme interpreter.  You link the library to your C program in 
the usual way.   You can call Guile from C or C from Guile.
http://www.gnu.org/software/guile/guile.html
-- 
mbstevens
http://www.mbstevens.com/