[Ecls-list] ffi:clines and @ preprocessing

Matthew Mondor mm_lists at pulsar-zone.net
Fri Mar 12 21:40:09 UTC 2010


Hello,

I've used FFI:CLINES in a macro to generate C functions automatically
to easily serialize full C structures to CL ones (in this situation,
those structures only require read-access CL-side, and since most slots
are likely to be accessed it's more efficient to serialize once than to
use per-slot accessor functions).

The system worked allright when I first created the structure using
MAKE-foo and passing that cl_object to the C function.  However as the
system became more complex I realized the C functions should create the
CL structure objects and return them instead, so that I could
recursively fill and return CL objects for complex C structures
embedding other structures.  I then did a test using FFI:C-INLINE which
used funcall(1, @make-foo) to create a CL structure instance, and that
worked.

However, when I converted the macro using FFI:CLINES to use this, 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, or should I find a way to use C-INLINE instead?  Also, I've not
fully read the compiler and I'm wondering if there's not a function I
could simply call to preprocess a string containing C code.

Thanks,
-- 
Matt




More information about the ecl-devel mailing list