1SWI(1)                      General Commands Manual                     SWI(1)
2
3
4

NAME

6       plld - Create a SWI-Prolog embedded executable
7

SYNOPSIS

9       plld options c-files o-files pl-files
10

DESCRIPTION

12       The utility plld is a front-end for the C-compiler and linker to create
13       a stand-alone executable from a series of C/C++ and Prolog input files.
14       It  extracts information from the SWI-Prolog executable pl, after which
15       it scans the arguments and breaks them  into  several  categories.   It
16       then calls the C-compiler to create an executable containing the user's
17       C-code and the SWI-Prolog kernel.  After this, it will call the  devel‐
18       opment environment to create a Prolog saved state from the prolog files
19       and finally it will create the target executable by  concatenating  the
20       state  to  the  emulator.  See also qsave_program/2 from the SWI-Prolog
21       manual.
22
23
24   Options
25       -pl prolog
26              Specifies the prolog version to use.  The default is  pl.   This
27              flag  may be used to choose between different versions installed
28              on your system, or to specify a modified  version.   A  modified
29              version  should understands the flags -dump-runtime-variables -f
30              file -F file -g goal -t toplevel.
31
32       -help  Shows options briefly
33
34       -nostate
35              Just relinks the kernel.  The newly linked kernel can only func‐
36              tion  in  the  presence of the development system.  Any supplied
37              prolog sourcefiles are ignored, and so  are  the  options  -goal
38              -toplevel -initfile.  -class This is the preferred way to attach
39              external modules to Prolog if dynamic loading is  not  supported
40              on your system.
41
42       -c     Compile  C  or  C++  source-files into object files.  This turns
43              plld into a replacement for the C or C++ compiler  where  proper
44              options such as the location of the include directory are passed
45              automatically to the compiler.
46
47       -E     Invoke the C preprocessor.  Used to make plld a replacement  for
48              the C or C++ compiler.
49
50       -shared
51              Link  C, C++ or object files into a shared object (DLL) that can
52              be loaded by the load_foreign_library/1 predicate.  If used with
53              -c  it  sets the proper options to compile a C or C++ file ready
54              for linking into a shared object.
55
56       -embed-shared
57              Embed SWI-Prolog into a DLL/Shared object rather  than  an  exe‐
58              cutable.  See the reference manual for details.
59
60       -dll   Windows only Same as -embed-shared Backward compatibility.
61
62       -F base
63              By default, none is passed to the pl command to create the saved
64              state.  Using -F xpce you can specify  loading  xpce.rc,  making
65              XPCE available to the saved state.
66
67       -goal goal
68              The goal that is initially executed when the toplevel is started
69              using PL_toplevel().  E.i. the default.  -g  flag  for  the  new
70              executable.
71
72       -toplevel goal
73              The  goal  that is executed as the main toplevel goal.  E.i. the
74              default.  -t flag for the new executable.
75
76       -initfile file
77              The file that is loaded by the toplevel.  E.i. the default.   -f
78              flag for the new executable.
79
80       -class {runtime,kernel,development}
81              Set  the  save-class  of the Prolog saved-state that is created.
82              If runtime (default), the resulting system leave  interpretation
83              of  all  arguments to the application.  If kernel all predicates
84              will be locked for the  tracer.   Finally,  if  development  the
85              state  is  saved  `as-is'  and  the  resulting  system processes
86              options just as the basic SWI-Prolog executable does.  See  also
87              qsave_program/2 in the SWI-Prolog reference manual.
88
89       -v     Verbose  operation.   This  echos  the commands before executing
90              them.  Note that some commands are printed  as  shell  commands,
91              but  actually executed by plld itself for compatibility with the
92              Win32 platforms.
93
94       -f     Fake operation.  Together with -v this prints the commands  that
95              need to be executed without actually doing anything.
96
97       -Ecppargument ...
98              If  the  first option is -E, all subsequent options are appended
99              and handed to the program selected by  SWI-Prolog  configure  to
100              run cpp.
101
102       -o file
103              Specifies  the  name  of  the  final executable.  The default is
104              a.out.
105
106       -cc C-compiler
107              Specify the compiler to use for *.c files.  Default is the  com‐
108              piler  used  to compile SWI-Prolog itself, as read from the fea‐
109              ture c_cc.
110
111       -c++ C++-compiler
112              Specify the compiler to use for C++ input files.  If the  C-com‐
113              piler is gcc this is g++, otherwise c++ is assumed.
114
115       -ld linker
116              Specifies  the  linker  to  use.  Default is the C-compiler.  On
117              Win32 platforms, the default is link.exe.
118
119       -llibrary
120              Specifies a C-library for linking the application.  By  default,
121              -lpl  (-lplmt if pl supports threading) as well as the libraries
122              required by the SWI-Prolog kernel will be passed to  the  C-com‐
123              piler.
124
125       -Llibrary-directory
126              Specifies  an  additional  library directory for the C-compiler.
127              By default, the runtime directory for the  current  architecture
128              is passed.
129
130       -g|-I*|-D*|-U*|-O*|-W*
131              Passed  to  the compiler as c-flags.  By default, the SWI-Prolog
132              include directory is passed  as  additional  include  directory.
133              The  following  -D flags are added by plld: -D__SWI_PROLOG__ and
134              -D__SWI_EMBEDDED__.
135
136       -pl-options*
137              Specify additional options for pl.  The first character  follow‐
138              ing  -pl-options determines the option-separator.  The remainder
139              of the argument is split using this separator and the parts  are
140              added  to  the option list for Prolog.  See also -cc-options and
141              -ld-options
142
143       -ld-options*
144              Additional options passed to  the  linker.   For  example:  -ld-
145              options,-Bstatic
146
147       -cc-options*
148              Additional options passed to both C- and C++-compiler.
149
150       *.o    Passed as input files to the linker.
151
152       *.c    Compiled  using  the  C-compiler, after which the object-file is
153              passed to the linker.  The object file is deleted at cleanup.
154
155       *.cc|*.C|*.cxx|*.cpp
156              Compiled using the C++-compiler, after which the object-file  is
157              passed to the linker.  The object file is deleted at cleanup.
158
159       *.pl|*.qlf
160              Passed as Prolog input files
161

BUGS

163       Parsing  the options and distributing them over the various programs is
164       probably incomplete. Feel free to modify it and please  forward  gener‐
165       ally useful modifications to prolog-bugs@swi.psy.uva.nl.
166
167       Some  care  has to be taken that the state created with qsave_program/2
168       is  self-contained  (i.e.  contains  no  references   to   the   Prolog
169       libraries).   Also, as the state is created using the development envi‐
170       ronment rather then the user's emulator, the  Prolog  code  cannot  use
171       directives that rely on the C-code added by the user.
172

SEE ALSO

174       pl(1) SWI-Prolog Reference Manual, http://www.swi-prolog.org
175
177       Copyright (C) 1991-2006, HCS, University of Amsterdam
178

AUTHOR

180       Jan Wielemaker
181
182
183
184                                  Feb 8, 2006                           SWI(1)
Impressum