| Did you know ... | Search Documentation: |
| PL_predicate() |
NULL, the current
context module is used. Both name and module are
encoded in UTF-8. If either name or module is not
valid UTF-8, the process is terminated using PL_api_error().
The predicate_t handle may be stored as global data and
reused for future queries229PL_predicate()
involves 5 hash lookups (two to get the atoms, one to get the module,
one to get the functor and the final one to get the predicate associated
with the functor in the module) as illustrated below.
static predicate_t p = 0;
...
if ( !p )
p = PL_predicate("is_a", 2, "database");
Note that PL_cleanup()
invalidates the predicate handle. Foreign libraries that use the above
mechanism must implement the module
uninstall() function to clear the predicate_t global
variable.