Calling Prolog from C

In order to make Prolog predicates callable from C, users must to replace the main.c file in the emulator with a new file that starts the users' own application. The following function must be executed before any call to Prolog predicates is executed:
       initialize_bprolog(int argc, char *argv[])
In addition, the environment variable BPDIR must correctly be set to the home directory in which B-Prolog was installed. The function initialize_bprolog() allocates all of the stacks that are used in B-Prolog, initializes them, and loads the bytecode file bp.out into the program area. BP_ERROR is returned if the system cannot be initialized.

A query can be a string or a Prolog term. A query can return a single solution, or it can return multiple solutions.



Subsections
Neng-Fa Zhou 2013-01-25