6 Miscellaneous Support
Allocates a memory block of an appropriate size, and initializes it
using values from lst and the given type. The
lst must hold values that can all be converted to C values
according to the given type.
Returns a pointer to an array of _scheme
values, which is the
internal representation of vec
Returns a pointer to an array of _double
values, which is the
internal representation of flvec
Returns or sets the error code saved for the current Racket
thread. The saved error code is set after a foreign call with a
option (see _fun
), but it can also be set explicitly (for example,
to create mock foreign functions for testing).
Changed in version 126.96.36.199 of package base: Added the one-argument variant.
Returns a platform-specific positive integer corresponding to a POSIX
errno code, or #f if the code is unknown. A code’s value
is known if the code is one of the recognized symbols described below
and the code was defined by the "errno.h" header used to
compile Racket. Note that the contents of "errno.h" vary based on
platform and compiler.
The recognized symbols currently consist of the 81 codes defined by
Std 1003.1, 2013 Edition (also known as POSIX.1), including
'EINTR, 'EEXIST, and 'EAGAIN.
Changed in version 188.8.131.52 of package base: Relaxed the contract and added
support for more symbols.
from a value matching from-type
value matching to-type
, where (ctype-sizeof from-type)
matches (ctype-sizeof to-type)
The conversion is roughly equivalent to
If v is a cpointer, (cpointer-gcable? v) is true,
and from-type and to-type are both based on
_pointer or _gcpointer, then from-type is
implicitly converted with _gcable to ensure that the result
cpointer is treated as referring to memory that is managed by the
If v is a pointer with an offset component (e.g., from
ptr-add), (cpointer-gcable? v) is true, and the
result is a cpointer, then the result pointer has the same offset
component as v. If (cpointer-gcable? v) is false,
then any offset is folded into the pointer base for the result.
Converts C cblock
, which is a vector of type
s, to a
Racket list. The arguments are the same as in the
. The length
must be specified because
there is no way to know where the block ends.