swipl-ld1
Create a swi-prolog embedded executable
Usage
swipl-ld options
c-files
o-files
pl-files
Overview
The utility swipl-ld is a front-end for the C-compiler and linker to create a stand-alone executable from a series of C/C++ and Prolog input files. It extracts information from the SWI-Prolog executable swipl, after which it scans the arguments and breaks them into several categories. It then calls the C-compiler to create an executable containing the user's C-code and the SWI-Prolog kernel. After this, if there are any Prolog files on the command line, it will call the development environment to create a Prolog saved state from the prolog files, and finally it will create the target executable by concatenating the state to the emulator; otherwise, it creates a normal executable (see also the option -nostate). See also qsave_program/2 from the SWI-Prolog manual.
Options
-plprolog-
Specifies the prolog version to use. The default is
swipl.This flag may be used to choose between different versions installed on your system, or to specify a modified version. A modified version should understands the flags-dump-runtime-variables-ffile-Ffile-ggoal-ttoplevel.
-
-help -
Shows options briefly
-
-nostate -
Just relinks the kernel. The newly linked kernel can only function in the presence of the development system. Any supplied prolog sourcefiles are ignored, and so are the options
-goal-toplevel-initfile.-classThis is the preferred way to attach external modules to Prolog if dynamic loading is not supported on your system.
-
-c -
Compile C or C++ source-files into object files. This turns
swipl-ldinto a replacement for the C or C++ compiler where proper options such as the location of the include directory are passed automatically to the compiler.
-
-E -
Invoke the C preprocessor. Used to make
swipl-lda replacement for the C or C++ compiler.
-
-dll -
Windows only Same as
-embed-sharedBackward compatibility.
-Fbase-
By default, none is passed to the swipl command to create the saved state. Using -F xpce you can specify loading xpce.rc, making XPCE available to the saved state.
-goalgoal-
The goal that is initially executed when the toplevel is started using
PL_toplevel(). The default is the same as the-gflag for theswiplcommand, that is: version/0 (you can avoid printing the header by-goalgoal). This option has no effect if there are no Prolog files in the executable.
-toplevelgoal-
The goal that is executed as the main toplevel goal. E.i. the default.
-tflag for the new executable.
-initfilefile-
The file that is loaded by the toplevel. E.i. the default.
-fflag for the new executable.
-class{runtime,kernel,development}-
Set the save-class of the Prolog saved-state that is created. If
runtime(default), the resulting system leave interpretation of all arguments to the application. Ifkernelall predicates will be locked for the tracer. Finally, ifdevelopmentthe state is saved `as-is' and the resulting system processes options just as the basic SWI-Prolog executable does. See alsoqsave_program/2in the SWI-Prolog reference manual.
-
-v -
Verbose operation. This echos the commands before executing them. Note that some commands are printed as shell commands, but actually executed by swipl-ld itself for compatibility with the Win32 platforms.
-
-f -
Fake operation. Together with
-vthis prints the commands that need to be executed without actually doing anything.
-Ecppargument ...-
If the first option is
-E, all subsequent options are appended and handed to the program selected by SWI-Prolog configure to runcpp.
-ofile-
Specifies the name of the final executable. The default is
a.out.
-ccC-compiler-
Specify the compiler to use for
*.cfiles. Default is the compiler used to compile SWI-Prolog itself, as read from the featurec_cc.
-
-c++ C++-compiler -
Specify the compiler to use for C++ input files. If the C-compiler is
gccthis isg++,otherwisec++is assumed.
-ldlinker-
Specifies the linker to use. Default is the C-compiler. On Win32 platforms, the default is
link.exe.
-
-llibrary -
Specifies a C-library for linking the application. By default,
-lswiplas well as the libraries required by the SWI-Prolog kernel will be passed to the C-compiler.
-
-Llibrary-directory -
Specifies an additional library directory for the C-compiler. By default, the runtime directory for the current architecture is passed.
-g|-I*|-D*|-U*|-O*|-W*-
Passed to the compiler as c-flags. By default, the SWI-Prolog include directory is passed as additional include directory. The following -D flags are added by swipl-ld: -D__SWI_PROLOG__ and -D__SWI_EMBEDDED__.
-pl-options*-
Specify additional options for
swipl.The first character following-pl-optionsdetermines the option-separator. The remainder of the argument is split using this separator and the parts are added to the option list for Prolog. See also-cc-optionsand-ld-options
-ld-options*-
Additional options passed to the linker. For example:
-ld-options,-Bstatic
-cc-options*-
Additional options passed to both C- and C++-compiler.
*.o-
Passed as input files to the linker.
*.c-
Compiled using the C-compiler, after which the object-file is passed to the linker. The object file is deleted at cleanup.
*.cc|*.C|*.cxx|*.cpp-
Compiled using the C++-compiler, after which the object-file is passed to the linker. The object file is deleted at cleanup.
*.pl|*.qlf-
Passed as Prolog input files
Releases
9 releases since Debian 6.0 (Squeeze); the text changed 2 times.