How can I compile a simple program in Prolog?

Asked

Viewed 1,299 times

4

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

swi-pl?- [load]. True

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

1 answer

3


According to the SWI-Prolog.com:

For local use, you usually do not want to make an executable. Simply create a script as described in Prologscript, is easy and starts only a little slower in most cases.
A SWI-Prolog executable is a single file consisting of a native system executable, with the saved-state beside him. State is created using qsave_program/2, as described in the manual.

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

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.