On 02/17/2012 06:06 PM, Myrosia Dzikovska wrote:
> I am considering moving to sbcl from Allegro CL. I work on a project
> that involves a bunch of components written in different languages,
> communicating using ICE middleware (http://www.zeroc.com). There is no
> "native" ICE interface for LISP, and none is planned anytime soon.
> There are C and Python interfaces. The protocol requirements are
> complex enough that I don't have time to implement these in LISP.
> My solution so far has been as follows: have the ICE server code
> running in C++, accepting requests. When a request comes in, the C
> code calls a lisp call handler, eventually gets the results back, and
> passes them to the caller. Calling LISP from C is possible, if
> awkward, in Allegro CL.
> Sbcl manual says that calling LISP from C is hackish and poorly
> supported, and does not provide any detail. In practice, doing this in
> ACL is extremely hackish as well, with various issues and
> restrictions. But it was documented enough for me to make it work.
> Has anyone had any experience with calling lisp from C in sbcl? I'd
> like to know if this is worth my time, or I should look for a
> different LISP distribution. I'd consider alternatives to directly
> calling LISP from C, e.g., if it would be possible to have a thread
> sleeping in LISP and woken up from C (but it's not obvious to me that
> it would work from the manuals, either).
Have you tried using CFFI ? CFFI provides macros for defining callbacks;
but more importantly provides a uniform API between different lisp
implementations for interfacing with foreign code.