Jeremy Smith jeremy@decompiler.org writes:
I want an array of structs. Not pointers to structs, but actual structs. So with an array of 4 16-byte structs, it should be 64 bytes.
I've got around the problem by using a struct which has 16 entries (4 * the 4-entry struct), but that's not desirable because it doesn't scale to more module entries without increasing the struct by 4 more entries.
I think this is what you want:
(defcstruct foo (x :int) (y :int) (z :int))
(with-foreign-object (foo-array 'foo 4) ...)
FOO-ARRAY will be a pointer to storage for 4 FOO structures.
Macroexpanding this WITH-FOREIGN-OBJECT:
(WITH-FOREIGN-POINTER (FOO-ARRAY 48) ...)
James