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

Chun Tian (binghe) binghe.lisp at gmail.com
Wed May 23 04:33:09 UTC 2007


2007年5月23日 星期三、Stephen Compall さんは書きました:
> 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.

I'm using the latest LW release (5.0.2). I've checked LW's Foreign Language 
Interface User Guide and Reference Manual, the foreign-typed-aref doesn't 
support 64bit types now:

http://www.lispworks.com/documentation/lw50/FLI/html/fli-98.htm#pgfId-1149659

  Description
    The function  foreign-typed-aref accesses a foreign array and is compiled 
to efficient code when compiled at safety 0. It corresponds to  
sys:typed-aref which accesses Lisp vectors.
    type must evaluate to  double-float ,  single-float ,  (unsigned-byte 
32) ,  (signed-byte 32) ,  (unsigned-byte 16) ,  (signed-byte 16) ,  
(unsigned-byte 8) or (signed-byte 8) .

I'll ask LW support if it's possible to support (signed-byte 64) and 
(unsigned-byte 64).

Thanks.

Chun Tian (binghe)

>
> 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.
-- 
'()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20070523/7c9b92e3/attachment.sig>


More information about the cffi-devel mailing list