[cffi-devel] About long-long support in AMD64 LispWorks

Martin Simmons martin at lispworks.com
Wed Jun 6 21:47:55 UTC 2007


>>>>> On Thu, 07 Jun 2007 01:48:27 +0800, Chun Tian (binghe) said:
> 
> Hi, CFFI Developers
> 
> I found that in AMD64 Linux, the long and long long type are both 8
> bytes. Can I directly map CFFI's :long-long into LispWorks FLI's :long
> type to get support for long-long type? (This is need when I compile
> iolib package in amd64 LispWorks):
> 
> cffi-lispworks.lisp:
> 
> (defun convert-foreign-type (cffi-type)
>   "Convert a CFFI type keyword to an FLI type."
>   (ecase cffi-type
>     (:char            :byte)
>     (:unsigned-char   '(:unsigned :byte))
>     (:short           :short)
>     (:unsigned-short  '(:unsigned :short))
>     (:int             :int)
>     (:unsigned-int    '(:unsigned :int))
>     (:long            :long)
>     (:unsigned-long   '(:unsigned :long))
>     #+amd64
>     (:long-long       :long)
>     #+amd64
>     (:unsigned-long-long '(:unsigned :long))
>     (:float           :float)
>     (:double          :double)
>     (:pointer         :pointer)
>     (:void            :void)))

This is not quite right -- it should use the type long-long on the right-hand
side.  Also, it may be better to do this unconditionally, so it works on any
LispWorks platform that supports it.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/



More information about the cffi-devel mailing list