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

Matthew Mondor mm_lists at pulsar-zone.net
Mon May 3 04:29:38 UTC 2010


On Sun, 02 May 2010 22:04:50 -0500
Seth Burleigh <seth at tewebs.com> wrote:

> I was wondering if it is currently possible to embed toplevel c/c++ code
> in a lisp file (structure definitions, but most importantly c/c++
> functions/methods). Just some ideas, i was wondering how 'difficult' the
> below would be, if it is worth it, etc.
[...]

Do you mean something more than the current FFI facilities (including
FFI:C-INLINE and FFI:CLINES)?  Because inline code can already be typed
litterally in lisp code, and lisp code can also generate dynamic C code
using those.

An example which heavily uses C-INLINE and CLINES for both litteral
inline C and dynamic C code generation can be found at:

http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/mmondor/mmsoftware/cl/test/ecl-unix.lisp?rev=1.1;content-type=text%2Fplain

Note that this code needs cleaning up and polishing, however.
Some fill functions are dynamically generated to serialize between C
and CL structures using CLINES.  Also, C-INLINE is used by the
defsyscall macros and for other litteral code.  C-INLINE is also used
by the code which generates CL accessor functions for C structures
(where this interface is prefered to fully serializing structures).
There is also litteral code inserted to deal with multiple BSD socket
address families and hash/compare addresses, as well as to deal with
unicode and with kevent arrays...

It's possible that you also meant higher level access than
CLINES/C-INLINE though, sorry if I'm stating the obvious in that case.
-- 
Matt




More information about the ecl-devel mailing list