Here is the second test that did not get pasted in the original paste. (defun test4 () (let* ((*readtable* (copy-readtable objc:*objc-readtable*)) (method-name "substringWithRange:") (method-info (find "GSCString" (gethash method-name objc:*methods*) :key (lambda (x) (slot-value x 'objc::class-name)) :test #'equal)) (num-args (+ 2 (objc::num-args method-info))) (cif (sb-alien:make-alien (sb-alien:struct ffi::ffi-cif))) (args (sb-alien:make-alien (* (sb-alien:struct ffi::ffi-type)) num-args)) (vals (ffi:malloc (* num-args ffi:*word-size*))) (rc (ffi:malloc ffi:*word-size*)) (ns-str (#/initWithCString: (#/alloc 'gs-base::ns-string) (sb-alien:alien-sap (sb-alien:make-alien-string "abc")))) (ns-str-ptr (ffi:malloc ffi:*word-size*)) (sel (objc:selector method-name)) (sel-ptr (ffi:malloc ffi:*word-size*)) (range-ptr (sb-alien:alien-sap (gs-base::ns-make-range 0 1)))) (setf (sb-alien:deref args 0) (sb-alien:addr ffi::ffi-type-pointer)) (setf (sb-alien:deref args 1) (sb-alien:addr ffi::ffi-type-pointer)) (setf (sb-alien:deref args 2) gs-base::*ns-range-type*) (setf (sb-sys:sap-ref-sap ns-str-ptr 0) ns-str) (setf (sb-sys:sap-ref-sap sel-ptr 0) sel) (setf (sb-sys:sap-ref-sap vals 0) ns-str-ptr) (setf (sb-sys:sap-ref-sap vals 8) sel-ptr) (setf (sb-sys:sap-ref-sap vals 16) range-ptr) (when (= ffi:ffi-ok (ffi:ffi-prep-cif cif ffi:ffi-default-abi num-args (sb-alien:addr ffi::ffi-type-pointer) args)) (format t "prepped cif!~%") (ffi:ffi-call cif (objc::method-getimplementation (objc::method-ptr method-info)) rc vals) (format t "called!~%") rc)))