[cffi-devel] problem with translation to foreign types

Luís Oliveira luismbo at gmail.com
Mon Apr 21 12:54:05 UTC 2008


On Mon, Apr 21, 2008 at 12:42 AM, Tamas K Papp <tpapp at princeton.edu> wrote:
>  (cffi:defctype my-double :double)
>
>  (defmethod cffi:translate-to-foreign (value (type (eql 'my-double)))
>   (coerce value 'double-float))

That should be:

* (define-foreign-type my-double-type ()
    ()
    (:actual-type :double)
    (:simple-parser my-double))

MY-DOUBLE-TYPE
* (defmethod translate-to-foreign (value (type my-double-type))
    (coerce value 'double-float))

#<STANDARD-METHOD TRANSLATE-TO-FOREIGN (T MY-DOUBLE-TYPE) {1003370511}>
* (convert-to-foreign 10 'my-double)

10.0d0

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/



More information about the cffi-devel mailing list