[cffi-devel] %mem-{set,ref} can be inlined?

Luís Oliveira luismbo at gmail.com
Sun Apr 25 14:21:32 UTC 2010


On Sun, Apr 25, 2010 at 1:55 PM, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> wrote:
> I had a look at the definitions of these two functions. Right now in
> cffi-ecl.lisp it seems that they are only called with basic types, for they
> call cffi-type->ecl-type which only deals with things like integers,
> doubles, etc.
>
> Could I just produce a compiler macro that relies on this? The result would
> be much much simpler than this as it could be inlined and make use of ECL's
> embedded C statements.

Yes, you can rely that. The CFFI-SYS layer will only ever handle with
those basic types. They are defined in src/types.lisp via
DEFINE-BUILT-IN-FOREIGN-TYPE.


> Actually it would be nice if instead of a compiler macro I could define them
> to be just plain macros. Anything that prevents it?

It might work for this particular case, but I'd prefer compiler
macros. See DEFINE-MEM-ACCESSORS in cffi-sbcl.lisp for an example.

-- 
Luís Oliveira
http://r42.eu/~luis/




More information about the cffi-devel mailing list