[cffi-devel] Using `define-foreign-type' as defclass
Luís Oliveira
luismbo at gmail.com
Mon Aug 27 09:54:39 UTC 2012
On Mon, Aug 27, 2012 at 10:04 AM, Diogo F. S. Ramos <diogofsr at gmail.com> wrote:
> (define-foreign-type easy-handle (a-parent-foreign-type/class)
> ((pointer :initform (curl-easy-init)))
> (:actual-type :pointer)
> (:simple-parser easy-handle))
>
> It works, be as the manual separate these things, I wonder: Am I using
> it wrong?
Say you now go ahead and use EASY-HANDLE as follows:
(defcfun foo :void (handle easy-handle))
When FOO is compiled, CFFI will instantiate an EASY-HANDLE and poke it
to determine things like the basic C type it translates. Your
definition is not adequate because it'll call CURL-EASY-INIT at this
point.
HTH,
--
Luís Oliveira
http://r42.eu/~luis/
More information about the cffi-devel
mailing list