[cffi-devel] Re: how to revise foreign type translators to work with cffi-newtypes
Luis Oliveira
luismbo at gmail.com
Thu Mar 15 05:14:31 UTC 2007
"Jack Unrue" <jdunrue at gmail.com> writes:
> (cffi:defctype rect-pointer :pointer)
(define-foreign-type rect-pointer-type ()
()
(:actual-type :pointer)
(:simple-parser rect-pointer))
> (defmethod cffi:free-translated-object (ptr (name (eql 'rect-pointer)) param)
> (declare (ignore param))
> (cffi:foreign-free ptr))
Now RECT-POINTER-TYPE is actually a CLOS class. So you should use a
normal specializer instead of an EQL specializer.
(defmethod free-translate-object (ptr (type rect-pointer-type) param)
...)
> Can anyone make suggestions as to what I should change to be compatible
> with the cffi-newtypes branch?
That's basically it. Change the type definition and change EQL
specializers to normal specializers. I've compiled the cffi-newtypes
manual and uploaded it here:
<http://common-lisp.net/~loliveira/tmp/cffi-newtypes/>
The section about foreign types should be updated. (Not all of the
reference nodes are though, I think.)
Now's a good time to object to this new interface and propose changes.
I'm all ears. :-) I sent some ideas a few weeks ago, but I don't really
have clean solutions. They can be read here:
<http://article.gmane.org/gmane.lisp.cffi.devel/1033>
> Second question -- do the WITH-FOREIGN-SLOTS and WITH-FOREIGN-OBJECT
> macros work the same way on cffi-newtypes as they did before? I imagine so,
> but it's worth asking just to be sure.
No changes there.
--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
More information about the cffi-devel
mailing list