next up previous contents index
Next: 3.3.2 Passing Commands to Up: 3.3 A C API Previous: 3.3 A C API   Contents   Index

3.3.1 Initializing and Closing XSB

int xsb_init_string(char *options)

This function is used to initialize XSB via an initialization string *options, and must be called before any other calls can be made. The initialization string must include the path to the XSB directory installation directory $XSB_DIR, which is expanded to an absolute path by XSB. Any other command line options may be included just as in a command line except -D, -d, -B and -i. For example, a call from an executable in a sibling directory of XSB might have the form
   xsb_init_string("../XSB -e startup.");
which initializes XSB with the goal ?- startup.

Return Codes

int xsb_init(int argc, char *argv[])

This function is a variant of xsb_init_string() which passes initialization arguments as an argument vector: argc is the count of the number of arguments in the argv vector. The argv vector is exactly as would be passed from the command line to XSB. The return codes for xsb_init() are the same as those for xsb_init_string().

int xsb_close()

This routine closes the entire connection to XSB . After this, no more calls can be made (not even calls to xsb_init_string() or xsb_init()). In Version 3.0, no guarantee is made that all space used by XSB will be restored to the process (even when the process has dynamically linked to XSB), but space for any XSB tables is freed.

Return Codes


next up previous contents index
Next: 3.3.2 Passing Commands to Up: 3.3 A C API Previous: 3.3 A C API   Contents   Index
Terrance Swift 2007-10-06