Next: , Previous: Using GValues, Up: Top

7 Stable pointers

Sometimes it is necessary to pass arbitrary Lisp object to C code and then receive it back. Stable pointer serve to this purpose. Stable pointer is an integer (that is passed to C code as a void* pointer) that is created on Lisp side by call to allocate-stable-pointer and can be dereferenced by Lisp side at any time by calling stable-pointer-value. Stable pointer exists and does not change its value until explicitly freed by calling free-stable-poitner. Convenience macro with-stable-pointer binds the stable pointer for the duration of its body.