C's types do not say which pointer arguments a function reads, which it writes, how long a buffer is, or who frees a pointer it returns. These annotations say it, for the declarations they are given to (design §4.3).
Details
ffi_in(len): an R vector the function reads. For a non-constpointer it is copied, so the function may write into the copy and the vector stays as it was; aconstpointer is passed with no copy.ffi_out(len): a buffer the function fills. zuffi allocateslenelements, the function writes them, and the call returns them.ffi_inout(len): an R vector copied into a buffer that the function reads and writes; the call returns the buffer.ffi_owned(free_fn): the result is a pointer thatfree_fn, a function of the same library, frees: zuffi frees it when the pointer is collected, or atffi_free().
For ffi_in() and ffi_inout(), len names the argument that holds
the buffer's length: the caller no longer gives it, and zuffi passes the
vector's length. For ffi_out(), len is the number of elements, or
the name of the argument the caller gives it in. Lengths count
elements; bytes for void *.
A function with ffi_out() or ffi_inout() arguments returns a list:
value, its result, and one element per such argument. Buffers of
void, char, unsigned char and uint8_t come back as raw vectors,
the others as their type's R vector (design §6).