[Ecls-list] Tighter c/c++ integration, toplevel inline c/c++ code ???

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Mon May 3 11:39:30 UTC 2010


On Mon, May 3, 2010 at 5:04 AM, Seth Burleigh <seth at tewebs.com> wrote:

> (1) A C/C++ program wants to call a lisp function with its own data
> structures:
>

These are called "callbacks". All foreign function interfaces for Lisp
support them, including CFFI and ECL. However ECL currently gives them
rather "obscure" names and does not export them.



> (2) Intertwined development/tight integration: if an algorithm needs to
> be implemented in c/c++ for efficiency, it is much more convenient to
> define it in the lisp code than create another c/c++ file
>

CLINES allows you to embed arbitrary C/C++ code in the file. The only thing
you will not get is that the code is produced in an order which is
consistent with the execution of Common Lisp forms. In other words, if you
insert a CLINES statement in a function it will be moved out of it to the
beginning of the generated C file.

Of course, the code would also have to be able to call lisp functions
> defined in the current package in order for this to be effective (or to
> be able to call lisp functions which have been designated as
> 'callbackable', like in gambit-c scheme) [...]
>

Se above.

(3) Programs built in c++ already have a class hierarchy. If you want to
> create a subclass which the c++ program can use, you need to be able to
> directly input toplevel code (i.e. define a class, methods, etc).
>

CLINES
http://ecls.sourceforge.net/new-manual/re13.html

I insist that this is mostly used for headers, but it need not be.

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100503/769f1b4b/attachment.html>


More information about the ecl-devel mailing list