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
Hello,
On 30/07/07, Tamas K Papp tpapp@princeton.edu wrote:
I have a class which is defined like this (basically, wraps a pointer):
[...]
For convenience, I would like to use it in place of a pointer, with some extra error checking:
We haven't updated the manual in the website yet. We need two versions up there (for the released and development versions), I suppose. Let me point you to sections 5.3 and 5.4 of CFFI's manual:
http://common-lisp.net/~loliveira/tmp/cffi-newtypes/html_node/Defining-Foreign-Types.html
It still needs some work so let us know if that doesn't answer all your questions.