- Documentation
- Reference manual
- Foreign Language Interface
- The Foreign Include File
- Analysing Terms via the Foreign Interface
- Reading data from a term
- PL_get_atom()
- PL_get_atom_chars()
- PL_get_string_chars()
- PL_get_chars()
- PL_get_list_chars()
- PL_get_integer()
- PL_get_long()
- PL_get_int64()
- PL_get_uint64()
- PL_get_intptr()
- PL_get_bool()
- PL_get_stdbool()
- PL_get_pointer()
- PL_get_float()
- PL_get_functor()
- PL_get_name_arity()
- PL_get_compound_name_arity()
- PL_get_module()
- PL_get_arg()
- PL_get_arg_values()
- PL_get_dict_key()
- Reading data from a term
- Analysing Terms via the Foreign Interface
- The Foreign Include File
- Foreign Language Interface
- Packages
- Reference manual
Availability:C-language interface function
.qlf file or used in arithmetic. PL_get_pointer()
only succeeds on a pointer integer, so a plain integer typed by the user
or computed using arithmetic is not taken for a pointer. A pointer must
fit in a small integer (max_tagged_integer);
otherwise PL_put_pointer()
and
PL_unify_pointer()
raise a representation error. The exception is 64-bit Android, which
keeps a tag in the top byte of heap pointers: there such pointers are
represented as plain integers and
PL_get_pointer()
accepts integers that are too large to be small. Representing C pointers
as integers is unsafe: the pointer may be used after the object
it points at is deallocated. The
blob API described in section
12.4.10 provides a safe way for handling foreign resources that
cooperates with Prolog garbage collection.