Next: , Up: Stable pointers


4.7.1 allocate-stable-pointer

— Function: allocate-stable-pointer
     (allocate-stable-pointer thing) => stable-pointer
thing
An arbitrary Lisp object
stable-pointer
A foreign pointer

Allocates a stable pointer to thing.

(Note: stable-pointer should not be dereferenced with cffi:mem-ref. It should only be dereferenced with stable-pointer-value)

Example:

     (allocate-stable-pointer (lambda (x) (+ x 10)))
     =>
     #.(SB-SYS:INT-SAP #X00000002)
     
     (stable-pointer-value *)
     =>
     #<FUNCTION (LAMBDA (X)) {1004D016F9}>
     
     (free-stable-pointer **)
     =>
     NIL