#include <quintus/quintus.h> int QP_register_atom(atom) QP_atom atom;
int QP_unregister_atom(atom) QP_atom atom;
garbage_collect_atoms/0 is able to locate all atoms accessible from Prolog
code, but cannot trace atoms that are only accessible from foreign code.
QP_register_atom() registers an atom as referenced from foreign code
so that if
garbage_collect_atoms/0 is called, the atom will not be
QP_unregister_atom() unregisters the atom, so that if no
other code (Prolog or foreign) refers to it, then it is a candidate for
atom garbage collection.
These functions use a reference counting mechanism to keep track of atoms that have been registered. As a result, it is safe to combine different libraries that register and unregister atoms multiple times; the atoms will not be reclaimed until everyone has unregistered them.
the current reference count of the atom
QP_ERROR if an error occurs.
Atoms do not normally need to be registered when calling foreign code. The only situation where this is needed is when the atom is being stored in a global or static data structure before returning to Prolog code, to be accessed subsequently by later calls to the foreign code.