example usage: (defcfun* ("test" test :method t) :error-int (a :int) (b :out :uchar) (c :int :key) (p :pointer) (flag :flag (:create :truncate)) (aflag :uint32 :const 0) (cl :uint32 :class (my-class value)) (cl2 :uint32 :class any-slot) (cl3 :pointer :key :class handle)) ==> (PROGN (DEFCFUN ("test" %TEST) :INT (A :INT) (B :POINTER) (C :INT) (P :POINTER) (FLAG :UINT32) (AFLAG :UINT32) (CL :UINT32) (CL2 :UINT32) (CL3 :POINTER)) (DEFMETHOD TEST (A P (CL MY-CLASS) CL2 &KEY C CL3 CREATE TRUNCATE) (WITH-FOREIGN-OBJECTS ((B :UCHAR)) (LET ((RET (%TEST A B C (IF (NOT P) (NULL-POINTER) P) (LOGIOR (IF CREATE 1 0) (IF TRUNCATE 128 0)) 0 (SLOT-VALUE CL 'VALUE) (SLOT-VALUE CL2 'ANY-SLOT) (IF (OR (NOT CL3) (NOT (SLOT-VALUE CL3 'HANDLE))) (NULL-POINTER) (SLOT-VALUE CL3 'HANDLE))))) (WHEN (STD-CHECK-ERROR RET) (VALUES (MEM-REF B :UCHAR)))))))
Macro DEFCFUN* if ret-type is keyword :error-int the cfunction will return an int indicating an error if ret!