Calling Prolog from C

To make Prolog predicates callable from C, one has to replace the main.c file in the emulator with a new file that starts his/her 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 be set correctly to the home directory where B-Prolog was installed. The function initialize_bprolog() allocates all the stacks used in B-Prolog, initializes them, and loads the byte code 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, and a query can return one solution and multiple solutions as well.



Subsections
Neng-Fa Zhou 2012-01-03