[cffi-devel] problem with translation to foreign types
Tamas K Papp
tpapp at Princeton.EDU
Sun Apr 20 23:42:21 UTC 2008
Hi,
I have a problem getting automatic type translation to work. In my
cl-cairo2 package (http://www.cliki.net/cl-cairo2), some cairo
functions expect booleans, but I want them to work with integers etc.
I set up a translate-to-foreign method as described in the manual, and
was using it, but recently it stopped working, in the sense that
translate-to-foreign still works when called manually, but functions
don't seem to call it (they did before, I changed nothing), and when
trying to check with convert-to-foreign, that does not work either.
I reduced my problem to a small, clean example:
(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, should be 10d0!
What am I doing wrong?
Thanks,
Tamas
PS: cl-cffi 20080217-1, sbcl 1:1.0.14.0-1.
More information about the cffi-devel
mailing list