I am trying to use SWI prolog embedded into by own application. Currently it loads from SWI prolog installation directory and loads standard boot.prc with it. Ultimately I want to make portable version of SWI Prolog to be deployed along with my appliocation without need of full-fledged SWI Prolog installation.
I also want to minimize redistributed codebase, so I want to make my own boot saved state.
However, I still can’t understand how to make Prolog to ignore default boot.prc and compile sources from my own boot source tree to make “clean” saved state which contains only needed code.
I also don’t understand how to make “prc” file, as saved states are qlf files.
The boot.prc file is basically just a .qlf file. You can of course try to change the files loaded during the boot compilation, but I cannot recommend that. The order of definitions is fragile as the C part of the code only provides a partial compiler. Notably boot/init.pl extends the compiler. Som of the other files in boot further extend it.
To create a stand-alone version, use
swipl -o myexe -c myloadfile.pl
The result should run, provided all shared objects/dlls are in a place where they can be found. There is a lot of tweaking that is platform dependent. If you really want you can end up with a single file executable for just about any program. Unfortunately, the process is not well documented and different for each OS
Some options you typically want are
--no-pce to disable including the gui into the state
--stand-alone on non-Windows systems to use swipl as basis rather than generating a shell script.
--foreign=save to include foreign extensions into the state. This has advantages and disadvantages. As we cannot load them into the process from the state the system will create temporary files and load these at runtime.