2.11.2 For running the result
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Overview
        • Compilation
          • For running the result
            • Using PrologScript
            • Creating a shell script
            • Creating a saved state
            • Compilation using the -c command line option
    • Packages

2.11.2.4 Compilation using the -c command line option

This mechanism loads a series of Prolog source files and then creates a saved state as qsave_program/2 does. The command syntax is:

% swipl [option ...] [-o output] -c file.pl ...

The options argument are options to qsave_program/2 written in the format below. The option names and their values are described with qsave_program/2.

--option-name=option-value

For example, to create a stand-alone executable that starts by executing main/0 and for which the source is loaded through load.pl, use the command

% swipl --goal=main --stand_alone=true -o myprog -c load.pl

This performs exactly the same as executing

% swipl
<banner>

?- [load].
?- qsave_program(myprog,
                 [ goal(main),
                   stand_alone(true)
                 ]).
?- halt.