package ctypes
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=e14c2c3a23ec7e21f2079652c23c309cd7cfb9582ebc2975007a29c88ce6f80d
md5=3b023d198feee3c63783591a750ef1d1
doc/ctypes/Ctypes/CArray/index.html
Module Ctypes.CArray
Operations on C arrays.
type 'a t = 'a carrayval get : 'a t -> int -> 'aget a n returns the nth element of the zero-indexed array a. The semantics for non-scalar types are non-copying, as for (!@).
If you rebind the CArray module to Array then you can also use the syntax a.(n) instead of Array.get a n.
Raise Invalid_argument "index out of bounds" if n is outside of the range 0 to (CArray.length a - 1).
val set : 'a t -> int -> 'a -> unitset a n v overwrites the nth element of the zero-indexed array a with v.
If you rebind the CArray module to Array then you can also use the a.(n) <- v syntax instead of Array.set a n v.
Raise Invalid_argument "index out of bounds" if n is outside of the range 0 to (CArray.length a - 1).
val unsafe_get : 'a t -> int -> 'aunsafe_get a n behaves like get a n except that the check that n between 0 and (CArray.length a - 1) is not performed.
val unsafe_set : 'a t -> int -> 'a -> unitunsafe_set a n v behaves like set a n v except that the check that n between 0 and (CArray.length a - 1) is not performed.
of_list t l builds an array of type t of the same length as l, and writes the elements of l to the corresponding elements of the array.
val to_list : 'a t -> 'a listto_list a builds a list of the same length as a such that each element of the list is the result of reading the corresponding element of a.
val length : 'a t -> intReturn the number of elements of the given array.
from_ptr p n creates an n-length array reference to the memory at address p.
make t n creates an n-length array of type t. If the optional argument ?initial is supplied, it indicates a value that should be used to initialise every element of the array. The argument ?finalise, if present, will be called just before the memory is freed.