Next: , Previous: Basic Pointer Operations, Up: Top


5 Foreign Memory Allocation

— Function: foreign-alloc size => pointer

Allocate size bytes of foreign-addressable memory and return a pointer to the allocated block. An implementation-specific error is signalled if the memory cannot be allocated.

— Function: foreign-free ptr => unspecified

Free a pointer ptr allocated by foreign-alloc. The results are undefined if ptr is used after being freed.

— Macro: with-foreign-pointer (var size &optional size-var) &body body

Bind var to a pointer to size bytes of foreign-accessible memory during body. Both ptr and the memory block it points to have dynamic extent and may be stack allocated if supported by the implementation. If size-var is supplied, it will be bound to size during body.