There are several ways to make a Prolog application available to your users. By far the easiest way is to require the user to install SWI-Prolog and deliver the application as a directory holding source files, other resources the application may need and a Prolog Script file that provides the executable. See section 18.104.22.168. The two-step installation may be slightly less convenient for the end user, but enables the end-user to conveniently run your program on a different operating system or architecture. This mechanism is obviously not suitable if you want to keep the source of your program secret.
Another solution is to use saved states, the main topic of
this chapter, together with the installed development system and disable
autoloading requirements into the state using
--no-autoload or the
This allows creating the application as a single file, while avoiding
the need to ensure that the state is self-contained. For large programs
this technique typically reduces startup time by an order of magnitude.
This mechanism is particularly suitable for in-house and cloud
deployment. It provides some protection against inspecting the source.
See section 14.6
The final solution is to make sure all required resources are present in the saved state. In this case the state may be added to the emulator and the application consists of the emulator with state and the shared objects/DLLs required to make the emulator work. If the emulator can be statically linked for the target platform this creates a single file executable that does not require SWI-Prolog installed on the target computer.