Summary of the Interface Functions

In this section you will find a summary of the functions and procedures of the Visual Basic interface:

Function PrologOpenQuery (ByVal Goal As String) As Long
This function will return a query identifier that can be used for successive retrieval of solutions. Returns -1 on error, e.g. a syntax error in the query.
Sub PrologCloseQuery (ByVal qid As Long)
This procedure will close the query represented by a query identifier qid. Please note: if qid is not the innermost query (i.e. the one opened last), then all more recently opened queries are closed as well.
Function PrologNextSolution(ByVal qid As Long) As Integer
This function retrieves a solution to the open query represented by the query identifier qid. Returns 1 on success, 0 on failure, -1 on error. In case of an erroneous execution, the Prolog exception raised can be retrieved with the PrologGetException procedure. Please note: Several queries may be open at the same time, however, if qid is not the innermost query, then all more recently opened queries are implicitly closed.
Function PrologGetLong(ByVal qid As Long, ByVal VarName As String, Value As Long) As Integer
Retrieves into Value the integer value bound to the variable VarName of the query identified by qid, as an integer. That is, the value of the given variable is converted to an integer. Returns 1 on success, i.e. if the given goal assigned an integer value to the variable; otherwise, it returns 0. If an error occurred it returns -1, e.g. if an invalid qid was used.
Function PrologGetString(ByVal qid As Long, Val VarName As String, Value As String) As Integer
Retrieves into Value the string value bound to a variable VarName of the query, as a string. That is, the value assigned to the given variable is written out into an internal stream by the write/2 Prolog predicate, and the characters output to this stream will be transferred to Visual Basic as a string. Retuns 1 on success, i.e. if the given goal assigned a value to the variable; otherwise, it returns 0. If an error occurred it returns -1, e.g. if an invalid qid was used.
Function PrologGetStringQuoted(ByVal qid As Long, ByVal VarName As String, Value As String) As Integer
Same as PrologGetString, but conversion uses Prolog writeq/2. Returns 1 on success, i.e. if the given goal assigned a value to the variable; otherwise, it returns 0. If an error occurred it returns -1, e.g. if an invalid qid was used.
Function PrologQueryCutFail (ByVal Goal As String) As Integer
This function will try to evaluate the Prolog goal, provided in string format, cut away the rest of the solutions, and finally fail. This will reclaim the storage used by the call. Returns 1 on success, 0 on failure and -1 on error.
Sub PrologGetException(ByRef Exc As String)
The exception term is returned in string format into the Exc string as if written by the writeq/2 predicate. If there is no exception available then the empty string is returned.
Function PrologInit() As Long
The function loads and initializes the interface. It returns 1 on success, and -1 otherwise.
Function PrologDeInit() As Long
The function deinitializes and unloads the interface, and returns any memory used by the interface to the operating system. It returns 1 on success, and -1 otherwise.