[Ecls-list] ffi:clines and @ preprocessing

Matthew Mondor mm_lists at pulsar-zone.net
Sat Mar 13 00:34:21 UTC 2010


On Sat, 13 Mar 2010 01:18:04 +0100
Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com> wrote:

> On Sat, Mar 13, 2010 at 12:00 AM, Juan Jose Garcia-Ripoll <
> juanjose.garciaripoll at googlemail.com> wrote:
> 
> > On Fri, Mar 12, 2010 at 10:40 PM, Matthew Mondor <mm_lists at pulsar-zone.net
> > > wrote:
> >
> >> I get
> >> C compilation errors: "error: stray '@' in program", suggesting that
> >> CLINES does not do @ preprocessing.  Is there a way to tell CLINES to
> >> do so,
> >
> >
> Ok, here it is (git/CVS, as usual)
> 
> $ ecl
> ECL (Embeddable Common-Lisp) 10.3.1
> Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
> Copyright (C) 1993 Giuseppe Attardi
> Copyright (C) 2000 Juan J. Garcia-Ripoll
> ECL is free software, and you are welcome to redistribute it
> under certain conditions; see file 'Copyright' for details.
> Type :h for Help.
> Top level in: #<process SI:TOP-LEVEL 000c9fc0>.
> > (compile-file "foo" :c-file t)
> [...]
> #P"/Users/jjgarcia/build/ecl/foo.fas"
> NIL
> NIL
> > (load "foo")
> 
> ;;; Loading #P"/Users/jjgarcia/build/ecl/foo.fas"
> #P"/Users/jjgarcia/build/ecl/foo.fas"
> > (foo)
> 
> MY-SYMBOL
> >
> $ cat foo.lsp
> (ffi:clines "
> cl_object
> aux() {
>    return @my-symbol;
> }")
> 
> (defun foo ()
>   (ffi:c-inline () () :object "aux()" :one-liner t))

Awesome, thanks for this.  I tried using the approach to export a CL
function's symbol for C to access it, but I didn't manage to get it
working so far, and was reading more and more the compiler and related
functions to find out how to make it work...  So the next step was to
use function pointers or the callback mechanism to allow me to do a
similar trick.

Thanks again,
-- 
Matt




More information about the ecl-devel mailing list