How can I compile a simple prolog program?

4

I have SWI-Prolog installed, but I'm using it as a kind of interpreter, exp:

swi-pl?- [load]. True

I would like to know if there is a simple command that I can use via terminal to compile the source code into an executable.

    
asked by anonymous 23.08.2016 / 21:28

1 answer

3

According to the SWI-Prolog.com :

  

For local use, you generally will not want to make an executable. Simply create a script, as described in PrologScript , it is easy and starts only a little slower in most cases.   A SWI-Prolog executable is a single file that consists of a native system executable, with the saved-state next to it. State is created using qsave_program/2 , as described in manual.

You can do a .exe using the qsave_program/2 or command line.
The command line below creates myapp.exe from load.pl and causes the program to start from main/0 :

plcon -o myapp.exe -c load.pl --goal=main

To run myapp.exe, it needs to be in the same folder or %PATH% to libpl.dll and any other dll called in the code.

23.08.2016 / 22:16