(define-ffi-struct NAME &rest SLOT...). A limited form of cl-defstruct that
works on foreign objects. This defines a new foreign structure type named
NAME. Each SLOT is of the form (SLOT-NAME :type TYPE). Each TYPE must be a
foreign type.
define-ffi-struct makes accessors for each slot of the form
NAME-SLOT-NAME. setf works on these accessors.
(define-ffi-struct test-struct (stringval :type :pointer) (intval :type :int)) (define-ffi-function test-get-struct "test_get_struct" test-struct nil test.so) (let ((struct-value (test-get-struct))) (list (ffi-get-c-string (test-struct-stringval struct-value)) (test-struct-intval struct-value))) ; => (string 23)