[cl-cairo2-devel] translation of my-double type to foreign is broken
Tamas K Papp
tpapp at Princeton.EDU
Sun Apr 20 23:44:45 UTC 2008
Hi Dimtry,
Thanks for the bug report. I can't figure it out, contacted the CFFI
folks about this. In the meantime, can you tell me what the following
does on your version:
(require :cffi)
(cffi:defctype my-double :double)
(defmethod cffi:translate-to-foreign (value (type (eql 'my-double)))
(coerce value 'double-float))
(cffi:translate-to-foreign 10 'my-double) ; => 10d0
(cffi:convert-to-foreign 10 'my-double) ; => 10
(please start a clean lisp, no previous packages loaded).
Also, you can pass doubles (like 200d0 100d0) to make these functions
work until I figure out a fix. The type translation is just a
convenience.
HTH,
Tamas
On Mon, Apr 21, 2008 at 01:59:43AM +0400, Dmitry Pavlov wrote:
> Hello,
>
> I have a problem compiling the cl-cairo2 manual:
>
> The 'make' command, executed from the 'tutorial' directory,
> says the following:
>
> Error during processing of --eval option "(progn (load
> \"example.lisp\") (quit))":
> The value 200 is not of type DOUBLE-FLOAT.
>
> The error is raised from the first call to cl-cairo at example.lisp:
>
> (create-ps-surface "example.ps" 200 100)
>
> It seems that 200 is not converted to my-double datatype before
> it is passed to the foreign function.
> translate-to-foreign method for my-double doesn't get called.
>
> I tried to fix the problem by hacking cl-cairo2-swig.lisp,
> but without success.
>
> I have SBCL 1.0.15 on Debian-unstable on amd64.
> cl-cffi version number is 0.9.2 (Debian package cl-cffi_20080217-1)
> cl-cairo2-latest.tar.gz I downloaded today from common-lisp.net.
>
> With regards,
> Dmitry
> _______________________________________________
> cl-cairo2-devel mailing list
> cl-cairo2-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cl-cairo2-devel
More information about the Cl-cairo2-devel
mailing list