I am having some trouble with what I think is defining C structs via libffi. Below are two tests; the first one works and just demonstrates correctly using libffi. The second test is almost identical to the first but the function passes a struct. Right below the tests I included the struct definitions for SBCL and libffi. (defun test3 () (let* ((*readtable* (copy-readtable objc:*objc-readtable*)) (method-name "characterAtIndex:") (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*)) (idx-ptr (ffi:malloc ffi:*word-size*))) (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-64 idx-ptr 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) (sb-alien:addr ffi::ffi-type-uint64)) (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) idx-ptr) (when (= ffi:ffi-ok (ffi:ffi-prep-cif cif ffi:ffi-default-abi num-args (sb-alien:addr ffi::ffi-type-uint16) args)) (format t "prepped cif!~%") (ffi:ffi-call cif (objc::method-getimplementation (objc::method-ptr method-info)) rc vals) (format t "called!~%") rc))) Here are the struct definitions for SBCL and then libffi (SB-ALIEN:DEFINE-ALIEN-TYPE NIL (SB-ALIEN:STRUCT NS-RANGE (LOCATION SB-ALIEN:UNSIGNED-LONG) (LENGTH SB-ALIEN:UNSIGNED-LONG))) (defparameter *ns-range-type* (sb-alien:make-alien (sb-alien:struct ffi:ffi-type))) (defun define-ns-range-type () (setf (sb-alien:slot (sb-alien:deref *ns-range-type*) 'ffi::size) 0) (setf (sb-alien:slot (sb-alien:deref *ns-range-type*) 'ffi::alignment) 0) (setf (sb-alien:slot (sb-alien:deref *ns-range-type*) 'ffi::type) ffi:ffi-type-struct) (setf (sb-alien:slot (sb-alien:deref *ns-range-type*) 'ffi::elements) (ffi:malloc (* 3 ffi:*word-size*))) (setf (sb-sys:sap-ref-sap (sb-alien:slot (sb-alien:deref *ns-range-type*) 'ffi::elements) 0) (sb-alien:alien-sap ffi::ffi-type-uint64)) (setf (sb-sys:sap-ref-sap (sb-alien:slot (sb-alien:deref *ns-range-type*) 'ffi::elements) 8) (sb-alien:alien-sap ffi::ffi-type-uint64)) (setf (sb-sys:sap-ref-sap (sb-alien:slot (sb-alien:deref *ns-range-type*) 'ffi::elements) 16) (ffi:null-pointer)))