next up previous contents index
Next: 3.2 Examples of Calling Up: 3. Embedding XSB in Previous: 3. Embedding XSB in   Contents   Index

3.1 Calling XSB from C

XSB provides several C functions (declared in $XSBDIR/emu/cinterf.h and defined in
$XSBDIR/emu/cinterf.c), which can be called from C to interact with XSB as a subroutine. These functions allow a C program to interact with XSB in a number of ways.

In general, while any functions in the C API to XSB can be intermixed, the functions can be classified as belonging to three different levels.

The appropriate level to use depends on the nature of the calling program, the speed desired, and the expertise of the programmer. By and large, functions in the VarString level are the the easiest and safest to use, but they depend on a C type definition that may not be available to all calling programs (e.g. it may be difficult to use if the calling program is not directly based on C, such as Visual Basic or Delphi). For such applications functions from the fixed-string level would need to be used instead. In general, most applications should use either functions from the VarString or the fixed-string level, rather than the register-oriented level. This latter level should only be used by programmers who are willing to work at a low interface level, when the utmost speed is needed by an application, and when multiple threads do not need to interact with XSB.


next up previous contents index
Next: 3.2 Examples of Calling Up: 3. Embedding XSB in Previous: 3. Embedding XSB in   Contents   Index
Terrance Swift 2007-10-06