[cffi-devel] Next release of CFFI with cffi-libffi

Luís Oliveira luismbo at gmail.com
Tue May 1 03:30:03 UTC 2012


On Mon, Apr 30, 2012 at 11:02 PM, Max Mikhanosha <max at openchat.com> wrote:
> This fixes it for me
>
> (defmethod foreign-type-size ((type symbol))
>  (let ((*parse-bare-structs-as-pointers* nil))
>    (foreign-type-size (parse-type type))))

Thanks everyone for digging into this. While this fix does indeed fix
the problem (nice catch!), using this special variable
*PARSE-BARE-STRUCTS-AS-POINTERS* clearly turned out to be an
overcomplicated and brittle approach.

I've pushed a rewrite that should be much more robust.


> The key code path is is this in define-compiler-macro mem-aref
>
> (mem-ref ,ptr ,type (* ,index ,(foreign-type-size (eval type))))

This highlights an important issue. We were not testing the
non-compiler-macro code paths on SBCL. I've submitted a patch for RT
that should help with that. As Stelian mentioned on IRC, we should
perhaps control the deactivation of compiler macros explicitly rather
than rely on EVAL not to use them. Curiously, forcing SBCL to use its
interpreter revealed a possible bug:
<https://bugs.launchpad.net/sbcl/+bug/992362>.

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




More information about the cffi-devel mailing list