Next: , Previous: , Up: iklib memory   [Index]


6.46.3 Memory operations

The following bindings are exported by the libraries (vicare) and (vicare system $foreign) and reexported by the library (vicare ffi).

Function: memcpy dst src count

Interface to the C function memcpy(), (libc)memcpy. Copy count bytes from the memory referenced by the pointer src to the memory referenced by the pointer dst; count must be an exact integer in the range of the C language type size_t. The two memory regions must not overlap. Return unspecified values.

Function: memmove dst src count

Interface to the C function memmove(), (libc)memmove. Copy count bytes from the memory referenced by the pointer src to the memory referenced by the pointer dst; count must be an exact integer in the range of the C language type size_t. The two memory regions can be overlapping. Return unspecified values.

Function: memset ptr value count

Interface to the C function memset(), (libc)memset.Set to value count bytes of the memory referenced by the pointer ptr. count must be an exact integer in the range of the C language type size_t, value must be an exact fixnum in the range [-128, 255]. Return unspecified values.

Function: memcmp pointer1 pointer2 count

Interface to the C function memcmp(), (libc)memcmp. Compare count bytes in the memory blocks referenced by pointer1 and pointer2, return a fixnum representing the classic comparison ternary result. count must be an exact integer in the range of the C language type size_t.

Function: memory-copy dst dst.start src src.start count

Copy count bytes from src starting at offset src.start to dst starting at offset dst.start. src and dst can be pointers or bytevectors; dst.start, src.start and count must be non–negative fixnums. The two memory regions must not overlap. Return unspecified values.

Function: memory->bytevector pointer number-of-bytes

Build and return a new bytevector object holding number-of-bytes from the memory region starting at pointer. number-of-bytes must be a non–negative fixnum.

Function: bytevector->memory bv
Function: bytevector->guarded-memory bv

Allocate a new raw memory block and copy into it the contents of bv. If successful return two values being the pointer object referencing the memory and a fixnum representing the length of the memory block; if allocation fails raise a non–continuable exception with components: &who, &message, &out-of-memory-error.

Memory allocated by bytevector->memory must be released by free; memory allocated by bytevector->guarded-memory is automatically released whenever the returned pointer object is garbage collected.


Next: , Previous: , Up: iklib memory   [Index]