Node:Evaluating a query with side effects, Next:, Previous:Retrieving variable values, Up:How to call Prolog from Visual Basic



Evaluating a query with side effects

If you are only interested in the side effects of a predicate you can execute it with the PrologQueryCutFail function call, which will find the first solution of the Prolog goal provided, cut away the rest of the solutions, and finally fail. This will reclaim the storage used by the call.

Example: this is how a Prolog file can be loaded into the Visual Basic program:

        ret = PrologQueryCutFail("load_files(myfile)")
     

This code will return 1 if myfile was loaded successfully, and -1 otherwise (this may indicate, for example, the existence_error exception if the file does not exist).