1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

add scm_{to,from}_pointer docs

* doc/ref/api-foreign.texi: Add documentation for scm_to_pointer and
  scm_from_pointer.
This commit is contained in:
Andy Wingo 2012-07-04 17:43:53 +02:00
parent d2e3579363
commit 467be245cb

View file

@ -582,6 +582,22 @@ Unsafely cast @var{pointer} to a Scheme object.
Cross your fingers! Cross your fingers!
@end deffn @end deffn
Sometimes you want to give C extensions access to the dynamic FFI. At
that point, the names get confusing, because ``pointer'' can refer to a
@code{SCM} object that wraps a pointer, or to a @code{void*} value. We
will try to use ``pointer object'' to refer to Scheme objects, and
``pointer value'' to refer to @code{void *} values.
@deftypefn {C Function} SCM scm_from_pointer (void *ptr, void (*finalizer) (void*))
Create a pointer object from a pointer value.
If @var{finalizer} is non-null, Guile arranges to call it on the pointer
value at some point after the pointer object becomes collectable.
@end deftypefn
@deftypefn {C Function} void* scm_to_pointer (SCM obj)
Unpack the pointer value from a pointer object.
@end deftypefn
@node Void Pointers and Byte Access @node Void Pointers and Byte Access
@subsubsection Void Pointers and Byte Access @subsubsection Void Pointers and Byte Access