The ffi/unsafe/cvector library exports the bindings of this section. The ffi/cvector library exports the same bindings, except for the unsafe make-cvector* operation.
The cvector form can be used as a type C vectors (i.e., a pointer to a memory block).
Like _bytes, _cvector can be used as a simple type that corresponds to a pointer that is managed as a safe C vector on the Racket side. The longer form behaves similarly to the _list and _vector custom types, except that _cvector is more efficient; no Racket list or vector is needed.
Allocates a C vector using the given type and length. The resulting vector is not guaranteed to contain any particular values.
Creates a C vector of the given type, initialized to the given list of vals.
Returns #t if v is a C vector, #f otherwise.
Returns the length of a C vector.
Returns the C type object of a C vector.
Returns the pointer that points at the beginning block of the given C vector.
References the kth element of the cvec C vector. The result has the type that the C vector uses.
Sets the kth element of the cvec C vector to val. The val argument should be a value that can be used with the type that the C vector uses.
Converts the cvec C vector object to a list of values.
Converts the list lst to a C vector of the given type.
(make-cvector* cptr type length) → cvector? cptr : any/c type : ctype? length : exact-nonnegative-integer?
Constructs a C vector using an existing pointer object. This operation is not safe, so it is intended to be used in specific situations where the type and length are known.