I would like to know if there is an "easy" way to call Prolog (preferably SWI-Prolog) code from C# code (in a Unity context).
I have already tried to use the SWI-Prolog - C# interface (source here) however it is not well maintained and I can't make it work with the last version of SWI-Prolog 64 bits (8.2.4 as of today).
I have also seen that it is possible to send information using an SWI-Prolog socket and a C# socket (or Unity Socket) but I can't make it work, and I am not sure using socket is the best idea for the performance.
The only solution working for me was using another "custom" prolog engine : CSharpProlog. This allows me to integrate Prolog code in CSharp files. Yet I would like to use SWI-Prolog if possible, do anyone knows how I can do that ?
From the link you provided, is not apparent that the source is available here. Just try to compile it, to fit your target machine architecture.
I'm trying to generate the interface on Linux, with MonoDevelop, but it's not immediate, will retry later. Meanwhile, you could try on Windows. Probably will be simpler...
edit
Now I had the time to attempt to compile from source in Windows 10 64 bits, and so far it seems to run pretty well. I'm using VisualStudio Community 2017, and after opened the solution (contrib-swiplcs\SwiPlCs_git.sln), have defined _PL_X64 in SwiPLcs properties - compilation.
HTH
edit
Have uploaded this repo that shows a simplified usage of SWIPlCs. Note there is a directory (swipl_cs) where I have simply copied (unchanged) the indispensable source files from SwiPlCs. There is a single Prolog file, that computes N-Queens problem solutions (just the first, to keep things as simple as possible) and displays the steps performed by CLP(FD) - thanks to Markus Triska for the original implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With