next up previous contents index
Next: Q3 Up: Frequently Asked Questions Previous: Q2   Contents   Index

A2

You can do this, but both the B-Prolog library and compiler in ``bp.out'' go with the application. The following tells you the trick:

  1. Add the following predicate as the first predicate into your program:
    
            top:-
               initialize_bp,
               get_main_args(L),
               call_you_program.
    
    where initialize_bp initializes the B-Prolog system (symbol tables, global variables, etc.), and get_main_args(L) fetches the command arguments into L as a list of atoms.

  2. Compile your program. Assume it is myprog.out.

  3. Modify the shell script file bp as follows and save it into another file, say mybp.


		 		   exec $BPDIR/Emulator/bprolog ... $BPDIR/bp.out 

$\Downarrow$
exec $BPDIR/Emulator/bprolog ... myprog.out $BPDIR/bp.out
In this way, your program rather than the B-Prolog interpreter will be executed first. In Version 3.1 or newer, you can use the bi-directional interface with C to build stand-alone applications.



Neng-Fa Zhou
1999-11-24