Prolog engine does not support multithreading.
Loading of a Prolog DLL initiates creation of one Prolog engine.
If the VC application (from different threads) calls simultaneously more than one
predicate from this DLL, they cannot be accomplished successfully.
Workaround
Loading (static or dynamic) of each new Prolog DLL (with a new filename) initiates a
separate independent Prolog engine in the program. Notice that sequential loading of the
second copy of a DLL with the same filename does not initialize a new Prolog engine.
Therefore, the following workaround can be suggested:
Each thread before calling predicate from a Prolog DLL can dynamically load a personal
DLL's copy by vpi_LoadDll (DLL_FileName_X) with a free (at the moment) name. This will
initiate separate Prolog engine and a call of one DLL's predicate in its context will be
save.
After returning from this predicate, the thread can again call any predicate from this
DLL or just download the DLL by vpi_FreeDll to free this DLL_FileName_X for subsequent
usage by other threads.
Simultaneous calls of predicates from different statically loaded Prolog DLLs are also
save.