[cffi-devel] Re: setf in with-foreign-slots cannot work with LispWorks 5.0 (64bit Linux)

Stephen Compall s11 at member.fsf.org
Tue May 22 20:11:01 UTC 2007


On Tue, 2007-05-22 at 18:48 +0800, Chun Tian (binghe) wrote:
> **++++ Error in (TOP-LEVEL-FORM 5): 
>   Type (SIGNED-BYTE 64) not supported by SYSTEM:TYPED-AREF.
> ; (TOP-LEVEL-FORM 6)
> ; *** 1 error detected, no fasl file produced.
> ;;; Compilation finished with 0 warnings, 1 error.
> 
> Is it a bug?

Yes, but it's debatable where the bug is.  cffi-sys on LispWorks expects
to be able to use fli:foreign-typed-aref for all primitive foreign types
(integers, pointers, and floats), and a :long on that platform is 64
bits.  That's a reasonable assumption as it seems to work on all other
LW setups tested thus far.

Some possible solutions:

1. The Right Thing would be to get LispWorks to support 64-bit integers
in foreign-typed-aref, at least on your platform.  Maybe this is already
done; I don't know what the latest LW release is.

2. The quick and horrible hack is to change all lines like this line in
src/cffi-lispworks.lisp

#+#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and) '(or))

to this:

#+(or) ;;foreign-typed-aref doesn't really work for me

and remove lines that looks like this:

#-#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and) '(or))

Obviously this will only apply on your install.

3. The slightly less horrible hack would be to change the interface of
cffi-sys::convert-foreign-typed-aref-type (definition and both uses) to
signal an error when the cffi-type argument cannot be so "converted", so
the caller can fallback on a less efficient expanded form.

-- 
;;; Stephen Compall ** http://scompall.nocandysw.com/blog **
Failure to imagine vast possibilities usually stems from a lack of
imagination, not a lack of possibility.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20070522/16e1c9f3/attachment.sig>


More information about the cffi-devel mailing list