chickadee » foreign » types » nonnull-scheme-pointer

scheme-pointertype
(scheme-pointer TYPE)type
nonnull-scheme-pointertype
(nonnull-scheme-pointer TYPE)type

An untyped pointer to the contents of a non-immediate Scheme object; for example, the raw byte contents of a string. Only allowed as an argument type, not a return type.

The optional element type TYPE may be used to specify what C type should be used in the generated code. This avoids the need to cast the argument.

The value #f is also allowed and is passed as a NULL pointer. For the nonnull- variant, passing #f will raise an exception.

Don't confuse this type with (c-pointer ...) which means something different (a machine-pointer object).

scheme-pointer is typically used to get a pointer to the raw byte content of strings and blobs. But if you pass in a SRFI-4 vector, you will get a pointer to a blob object header (not the blob's contents), which is almost certainly wrong. Instead, convert to a blob beforehand, or use a SRFI-4 specific type.