[cffi-devel] translate-to-foreign on a class
Tamas K Papp
tpapp at Princeton.EDU
Mon Jul 30 14:49:56 UTC 2007
Hi,
I have a class which is defined like this (basically, wraps a pointer):
(defclass x-display ()
((display-pointer
:initform (null-pointer)
:initarg :display-pointer
:documentation "pointer to an Xlib display structure")))
For convenience, I would like to use it in place of a pointer, with
some extra error checking:
(defmethod translate-to-foreign (value (type (eql 'x-display)))
(with-slots (display-pointer) value
(when (null-pointer-p display-pointer)
(error "the X11 display is not open"))
display-pointer))
But this doesn't work: functions complain that they expect a
system-area-pointer (I am in SBCL), so this method is not called.
What am I doing wrong?
Thanks,
Tamas
More information about the cffi-devel
mailing list