qld
-- QOF link editorqld [-cCdDEghkNqrRsSvwWxY] [ -o output ] [ -llibrary ] [ -L library-directory ] [ -a quintus-product ] [ -f path-name:path-spec ] [ -F path-name:path-spec ] [ -p path-name ] [ -P path-name ] filename ... [ -LD ld-options ]
qld
links the specified QOF files together with the Kernel QOF
file. This results in a single QOF file, which is then consolidated
into a machine object file.
Finally, the native compiler/linker is invoked
to link this object file with the Kernel object file and produce an
executable image.
The default Kernel QOF file is
runtime-directory
/qprte.qof
.
Under UNIX, the default Kernel Object file is
runtime-directory
/qprte.o
; under Windows it consists of
runtime-directory
/qprte.lib
and
runtime-directory
/qpeng.lib
(see
qsetpath(1)
and qgetpath(1)
).
If any of the specified files depends on a foreign file, then that
file will be included in the call to the C compiler or linker if the -d
option is
specified. A QOF file depends on a foreign file if its source
contains an embedded load_foreign_files/2
or
load_foreign_executable/1
command for that file (the -D
option
of qnm(1)
shows the dependencies of a QOF file; see qnm(1)
).
A filename in the command line could be either a QOF file with .qof
suffix, an object file, a shared object file (UNIX only),
an import library (Windows only),
or an archive file. If the
filename specified is a machine object file, it will be passed as an argument
to the C compiler or linker.
If the command line file does not exist, the same file
with a .qof
suffix is tried.
File names may be specified either as regular paths (e.g. file.qof
,
~/home/file.o
) or as Prolog file search paths, such as library(file)
,
home(system(file.o))
, etc. Note that the file search path specifications
may need to be quoted to escape the shell's interpretation of the parentheses.
The intermediate QOF and object files are deleted when qld
exits (unless
the -k
options is specified; see below). By
default, these files are stored in the directory /tmp
. The
environment variable TMPDIR
may be set to specify another directory to
be used instead for temporary files. If TMPDIR
is set to a non-existent
directory or to a directory to which the user does not have read and write
permissions then the default value of TMPDIR
is used for temporary files.
-a
quintus-product
-L
switches. Note that the libraries shipped with Quintus Prolog (qui
,
proxt
, and proxl
) are automatically available in the system, and,
therefore, require no -a
flag.
-c
qld
terminates after producing a machine object file. It does
not call the C compiler or linker to produce an executable image. If an output filename
is not specified with the -o
option, the file is named
a.o
under UNIX and a.obj
under Windows. No
foreign files, e.g. foreign dependencies, are included in the output file.
The resulting object file may be passed to qld
again on a different
command (with -N
), or it may be passed directly to the linker.
-d
qpc(1)
calls qld
. It causes
all QOF files on which any of the specified files depends to be linked
in as well, and any machine object files on which any of the linked
QOF files depends to be passed to the C compiler or linker. A QOF file depends on
another QOF file if the source for the first contains an embedded
command to load the source of the second. A QOF file depends on an
object file if its source contains an embedded load_foreign_files/2
or load_foreign_executable/1
command of the object file.
-f
path-name:
path-specSimilar to the
-L
option, but
path-name:path-spec defines a general file search path, which
instructs qld
to look for a file in directory path-spec whenever a
file specification of the form path-name
(
file-spec)
is encountered in
QOF file dependencies or on the command line. The path-name
and the directory, path-spec, are separated by a colon (:
), and, therefore,
path-name cannot contain a colon. If path-spec is given in the
file search path form (as in library:mylib(library)
), then
the argument must be quoted to escape the shell's interpretation of the
parentheses. path-spec may be .
or null, in which case .
is assumed.
There may be a list of path definitions (i.e. -f
or -F
options) for the same
path-name.
qld
searches the list, just like prolog
and qpc
, whenever it needs to
expand a file search path specification. The -f
options appends (like
assertz in prolog
and qpc
) the new path to the end of the list of
paths for path-name, while -F
prepends (like asserta in prolog
and qpc
).
-g
qld
, but is intended for the linker.
If some of the specified object files or object dependency files are
compiled with the debug flag, this option should be specified to preserve
the debugging information in the executable.
-h
-k
-l
library
qld
, but is intended for
the linker, which is called to link with the specified library to
product the executable.
-o
output
a.out
under UNIX or a.exe
under Windows.
With the -r
or -R
options, the default name is a.qof
.
With the -c
or -C
options, the default name is
a.o
under UNIX or a.obj
under Windows.
-p
path-name
*
then all file search path definitions are printed.
-q
-r
option but also adds a Kernel QOF file qprte.qof
or qprel.qof
. This option should very rarely be necessary.
-r
qld
terminates after linking
together all the specified QOF files to make a new QOF file. No Kernel
QOF file is not linked in. If an output filename is not specified with
the -o
option, the file is named a.qof
.
If -d
is not used in conjunction with this option, then it is
recommended that the output file, as specified by the -o
option, be in
the current working directory. This way, any dependencies of the
output QOF file on other files will be correct. Otherwise, the
dependencies would only be correct when absolute, as opposed to
relative, paths had been specified in the sources. This matters only
if this file is to be used in a future call to qld
with the -d
option
specified.
-s
qld
, but is intended for the linker,
which is called to actually generate the executable. The -s
option instructs the linker to strip the executable. Please note: that
once the executable is stripped then the dynamic foreign interface
including the Prolog builtins load_foreign_files/2
and
load_foreign_executables/1
cannot work.
-v
qld
echoes its activities,
including calls to subcomponents and ld.sh
-w
-x
qld
gives warnings about the
predicates that are not called, as well as those that are undefined.
Also, a warning message will be printed if either of the
user-definable predicates (portray/1
and user_error_handler/4
) is
undefined. (Such warnings are normally suppressed for these predicates.)
The -x
option overrides the -w
option.
-C
-c
, except that the object dependencies of QOF
files are also linked into the created object file. The object file
so produced can be directly passed to the C compiler, linker, or qld -N
to generate the executable.
-D
qld
links the specified files with
the Development Kernel rather than the Runtime Kernel.
The Development Kernel QOF file,
runtime-directory/qprel.qof
, is
linked with the specified QOF file, and the Development Kernel object
file(s).
Under UNIX, the Development Kernel Object file is
runtime-directory/qprel.o
; under Windows it consists of
runtime-directory/qprel.lib
and
runtime-directory/qpeng.lib
.
The -D
option may not be used in conjunction with the
-E
option.
-E
qld
to link the specified files with
the Extended Runtime Kernel rather than the Runtime Kernel (see
sap-srs). The Extended Runtime Kernel QOF file,
runtime-directory/qprex.qof
, is linked with the specified
QOF file, and the default Kernel object file.
Under UNIX, the default Kernel Object file is
runtime-directory/qprte.o
; under Windows it consists of
runtime-directory/qprte.lib
and
runtime-directory/qpeng.lib
The -E
option may not be used in conjuction with the -D
option.
-F
path-name:
path-spec
-f
, but the path is added at
the front of the list
of paths for path-name. Note that -F library:
library-directory
is identical
to -L
library-directory
.
-L
library-directory
library(
Filespec)
are searched for in the
library search paths when that file is linked. The initial search
paths are the same as in the Development System (see prolog(1)
).
Additional directories may be prepended to the list of library
search paths with this option.
Note that the command line is parsed from left to right. Also note
that the -L
must be followed by a space; otherwise, qld
assumes that
the option specifies a library directory for the linker.
Library directories may also be specified with the -f
and -F
options.
Note that library-directory may be a path to a directory (e.g. dir
, ~/dir
) or a
file search path specification of the form mylib(library)
. In the latter
case, the path-name mylib
must be defined by a -f
or -F
option.
-L
directory
-L
option to the C compiler and linker, and
specifies
a directory in which the linker looks for library files. This option is simply
passed to the linker.
-LD
-N
qprel.qof
/qprel.o
,
qprex.qof
/qprte.o
or qprte.qof
/qprte.o
) from the
runtime directory. This option is only useful for producing an
executable image from a machine object file that was created
from QOF files using qld
(see -C
).
-P
path-name
-p
, but the absolutized versions of the file
search paths are also printed.
-R
-r
, but it does not include the resulting
dependencies. This flag is mainly useful for clearing the
dependencies from the QOF file (for example, when they get absolutized
by save_program/[1,2]
or save_modules/2
).
-S
Note that if the shared object file that is being substituted contains
dependencies to other shared libraries then these have to be included
in the qld
command line. Running ldd(1)
on a shared object file will
indicate whether it has such dependencies.
-W
-subsystem:windows
,
instead of -subsystem:console
, to the linker so that a windowed
executable is built, rather than a console-based one.
The window properties of executables built with -W
can be controlled by
the environment variable CONSOLE
; see below.
Other properties of the Windows component of such executables built with
-W
can be controlled with resource files.
qld
recognizes files with the .res
extension as resource files
and treats them like object files, passing them to the linker.
Resource files are generated from .rc
files using the rc
program
supplied with Microsoft Visual C++. They contain various information relating to
the Windows component of an application,
such as the program name, icon and key bindings.
The file messages(system('qpwin.res'))
contains such data for the Quintus Prolog
window.
Thus, the qpwin.exe
executable can be generated with the command:
C:\> qld -WDdo qpwin.exe messages(system(qpwin.res))
The Quintus Prolog resource source file is in
quintus-directory
\src\embed\qpwin.rc
and this references the icon file
quintus-directory
\src\embed\qp.ico
, which rc
also incorporates
into qpwin.res
.
-Y
/dll
to the linker. See
sap-rge-dll for details.
TMPDIR
/usr/tmp
.
CONSOLE
-W
.
The value should be a comma separated list of:
sl:
INT
cols:
INT
rows:
INT
x:
INT
y:
INT
For example, setting CONSOLE
to sl:400,rows:32
before starting
qpwin
yields a window with 32 rows and a history buffer of size 400.
file.qof
$TMPDIR/qp*.{qof,o,obj}
runtime-directory/qcon
runtime-directory/qprel.{o,lib}
runtime-directory/qprte,{o,lib}
runtime-directory/qpeng.lib
runtime-directory/qprel.qof
runtime-directory/qprte.qof
runtime-directory/qprex.qof
runtime-directory/ld.sh
cc(1)
, ld(1)
, qcon(1)
,
qgetpath(1)
, qnm(1)
, qpc(1)
, qsetpath(1)