Also to Arne Skjærholt for the 64-Bit version (SwiPlCs64.dll).
Here is the link to download the latest binaries or older versions.
There is also a copy on SWI-Prolog Twiki page and SWI-Prolog contrib page. The latter might be outdated.
At present I only publish the binaries including the documentation. The sources, which are now under LGPL 2, might be published later. If you like to see them or work on them don't hesitate to contact me via mail.
The latest version work with SWI-Prolog 5.8.0 and higher.The AssemblyVersion number, e.g. 1.1.578.0, can be interpreted as follows:
- 1 - major version
- 1 - minor version
- 578 - SWI-Prolog version 5.7.8 (test cases run against this prolog version)
- 0 - patch level version
Copy SwiPlCs.dll or SwiPlCs64.dll and SwiPlCs.XML where ever you want and add in your project a reference to SwiPlCs.dll.
After that IntelliSense and tool tips should be available.
Make sure that libswipl.dll and its dependencies could be found by the system. For the sample below it is libswipl.dll and pthreadVC.dll. For a big application it could be a lot more.
TIP: For development add the SWI-prolog bin directory to the PATH environment variable.
NOTE: Don't forget to restart Visual Studio after that. VS must recognize the new environment for debugging.
Basically windows search first in the folder where the executable resist than in the windows system directory and at least in the directories that are listed in the PATH environment variable. For details see "Dynamic-Link Library Search Order"
If libswipl.dll or one of its dependencies could not found you will recive an error like
System.IO.FileNotFoundException: Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E)
An other common error is:
SWI-Prolog: [FATAL ERROR:
Could not find system resources]
Failed to release stacks
To fix this add the SWI_HOME_DIR environment variable as described in SWI-Prolog FAQ FindResources with a statment like this befor calling PlEngine.Initialize.
A sample says more then I want to write here.
Here is how to use the library in F#. Manny thanks to Foutelet Joel for this sample.
For further samples see the examples in
See marshalling in the source NativeMethods.cs