[cffi-devel] About long-long support in AMD64 LispWorks
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))) Thanks. Chun Tian (binghe)
On Thu, 2007-06-07 at 01:48 +0800, Chun Tian (binghe) wrote:
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):
Certainly. But that won't solve the problem with supporting :long itself on LW. I assume you are using one of the workarounds I posted earlier, or some other hack of cffi-lispworks. You should also make sure that you don't define the cffi-features:no-long-long "feature" in your version. -- ;;; Stephen Compall ** http://scompall.nocandysw.com/blog ** Failure to imagine vast possibilities usually stems from a lack of imagination, not a lack of possibility.
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): hi, you can take a look at the patch I sent here some weeks ago under
On Thu, Jun 07, 2007 at 01:48:27AM +0800, Chun Tian (binghe) wrote: the subject "emulating LONG-LONG on ECL". if luis likes the approach, that patch can be extended to any implementation that doesn't handle :long-long, including lispworks and allegro -- (sign :name "Stelian Ionescu" :aka "fe[nl]ix" :quote "Quidquid latine dictum sit, altum videtur.")
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/
Hi, Martin Sorry, after trying (fli:size-of '(:long :long)), I found that my LispWorks already support long-long foreign type. I think I should just remove cffi-features:no-long-long feature in cffi-lispworks.lisp, at least for my personal use. By the way, with some trivial changes, I can compile the whole iolib package (heavily depends on cffi) in amd64 lispworks now. Thank for point out this. Martin Simmons wrote:
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.
participants (4)
-
Chun Tian (binghe)
-
Martin Simmons
-
Stelian Ionescu
-
Stephen Compall