In development and runtime systems alike, Prolog and C code may call each other to arbitrary depths.
Before calling a predicate from C you must look up the
predicate definition by module, name, and arity. The
SP_predicate() will return a pointer to this definition
NULL if the predicate is not visible in the
module. This definition can be used in more than one call to
the same predicate.
SP_pred() may be used as an alternative to the
above. The only difference is that the name and module
arguments are passed as Prolog atoms rather than strings,
and the module argument is mandatory. This saves the cost
of looking up the two arguments in the Prolog symbol table. This
cost dominates the cost of the operation.
|• Finding One Solution of a Call:||Finding One Solution of a Call|
|• Finding Multiple Solutions of a Call:||Finding Multiple Solutions of a Call|
|• Backtracking Loops:||Backtracking Loops|
|• Calling Prolog Asynchronously:||Calling Prolog Asynchronously|
|• Exception Handling in C:||Exception Handling in C|
|• Reading a goal from a string:||Reading a goal from a string|