Hey all!
I can't seem to figure out why my translate-from-foreign method is not getting called:
(defconstant +PIB-OK+ 0)
(defctype tPIBAMQPrc :int) (defctype tsPIBAMQPContextPtr :pointer)
(defmethod translate-from-foreign (value (type (eql 'tPIBAMQPrc))) (if (not (= value +PIB-OK+)) (error "*** PIB AMQP error: ~d." value)) value)
Having a foreign function like
(defcfun ("nPIBAMQPConnect" %mq-connect) tPIBAMQPrc (mq-context-ptr tsPIBAMQPContextPtr))
return values of > 0 does not trigger the above-mentioned method ... I haven't looked into CFFI internals yet.
TIA !
Regards Frank
Oh - I'm on AllegroCL Mac OS X Intel 64bit..
;-)
Thanks!
Frank
Am 26.01.2010 um 23:14 schrieb Frank Goenninger:
Hey all!
I can't seem to figure out why my translate-from-foreign method is not getting called:
(defconstant +PIB-OK+ 0)
(defctype tPIBAMQPrc :int) (defctype tsPIBAMQPContextPtr :pointer)
(defmethod translate-from-foreign (value (type (eql 'tPIBAMQPrc))) (if (not (= value +PIB-OK+)) (error "*** PIB AMQP error: ~d." value)) value)
Having a foreign function like
(defcfun ("nPIBAMQPConnect" %mq-connect) tPIBAMQPrc (mq-context-ptr tsPIBAMQPContextPtr))
return values of > 0 does not trigger the above-mentioned method ... I haven't looked into CFFI internals yet.
TIA !
Regards Frank
cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
On Tue, Jan 26, 2010 at 10:14 PM, Frank Goenninger frgo@me.com wrote:
(defctype tPIBAMQPrc :int) (defctype tsPIBAMQPContextPtr :pointer)
(defmethod translate-from-foreign (value (type (eql 'tPIBAMQPrc))) (if (not (= value +PIB-OK+)) (error "*** PIB AMQP error: ~d." value)) value)
You can't define type translators for types defined with DEFCTYPE anymore. Sections 6.3 and 6.4 of the manual should hopefully guide you through DEFINE-FOREIGN-TYPE and TRANSLATE-FROM-FOREIGN.