HELP LINK — VMS 5.4
Invokes the VMS Linker, which links one or more object modules
into a program image and defines execution characteristics of the
image. For a complete description of the linker, including more
information about the LINK command, see the VMS Linker Utility
Manual.
Format
LINK filespec[,...]
Additional information available:
PARAMETER
filespec[,...] Specifies one or more input files (wildcard characters not allowed). Input files may be object modules, libraries to be searched for external references or from which specific modules are to be included, shareable images to be included in the output image or option files to be read by the linker. If you specify more than one input file, separate the file specifications with either commas (,) or plus signs (+). In either case, the linker creates a single image file. If you omit the file type in an input file specification, the linker supplies default file types, based on the nature of the file. For object modules, the file type OBJ is assumed.
Description
Before a source-language program can run on the VMS operating system, it must be translated into object code and then linked. The VMS Linker binds the object modules, together with any other necessary information, into an executable image. To invoke the VMS Linker from DCL level, enter the LINK command and the command parameter. For an executable image, the command parameter specifies one or more input files including object modules to be linked, libraries to be searched for external references or from which specific modules are to be included, and option files to be read by the linker. Note that you cannot specify a shareable image input file from the command line; it can only be specified from a statement within an options file that you name on the command line. If you name several input files on the command line, separate the file specifications with commas or plus signs. For a shareable image, the command parameter specifies the name of the shareable image being created. You can direct output to different types of files by using appropriate qualifiers, such as /EXECUTABLE, /SHAREABLE, /MAP, and /SYMBOL_TABLE. By default, linker output and messages are directed to the SYS$OUTPUT device. Unless you specify otherwise, output files take the name of the first input file in the command parameter. The command line can include qualifiers that either modify the command itself, or modify a particular file in a list. A command qualifier modifies the command itself and can be located anywhere on the command line. Its position does not alter its function. Positional qualifiers indicate which of the files in the command parameter list are to be the object of the specified action. If you position the qualifier next to the command, all listed files are affected. To affect one or more files selectively, position the qualifier immediately after the appropriate file specifications. If you specify incompatible qualifiers, the linker either ignores the command and displays an error message or it may ignore the incompatibility and permit the linking operation to continue.
QUALIFIERS
Additional information available:
/BRIEF/CONTIGUOUS/CROSS_REFERENCE/DEBUG/EXECUTABLE
/FULL/HEADER/INCLUDE/LIBRARY/MAP/OPTIONS/P0IMAGE
/PROTECT/SELECTIVE_SEARCH/SHAREABLE/SHAREABLE
/SYMBOL_TABLE/SYSLIB/SYSSHR/SYSTEM/TRACEBACK
/USERLIBRARY
/BRIEF
Requests the linker to produce a brief map (memory allocation) file; the /BRIEF qualifier is valid only with the /MAP qualifier. A brief form of the map contains the following information: o A summary of the image characteristics o A list of all object modules included in the image o A summary of link-time performance statistics
/CONTIGUOUS
/CONTIGUOUS
/NOCONTIGUOUS (default)
Controls whether the output image file is contiguous.
/CROSS_REFERENCE
/CROSS_REFERENCE
/NOCROSS_REFERENCE (default)
Controls whether the memory allocation listing ( map ) contains a
symbol cross-reference list with entries for each global symbol
referenced in the image, its value, and all modules in the image
that refer to it.
/DEBUG
/DEBUG[=filespec]
/NODEBUG (default)
Controls whether a debugger is included in the output image.
If the object module contains local symbol table or traceback
information, you can specify the /DEBUG qualifier to include the
information in the image as well. If the object module does not
contain local symbol table or traceback information, only global
symbols are available for symbolic debugging.
If you specify the /DEBUG qualifier, the VAX Symbolic Debugger
is linked with the image by default. However, you can use the
filespec option to specify an alternate debugger (wildcard
characters are not allowed).
For information on using the VMS Debugger, see the VMS Debugger
Manual.
/EXECUTABLE
/EXECUTABLE[=filespec]
/NOEXECUTABLE
Controls whether the linker creates an executable image.
By default the linker creates an executable image with the same
file name as the first input file and a file type of EXE, but
this qualifier gives you the option of assigning the image a file
specification (wildcard characters not allowed).
The placement of the command qualifier determines the output file
specification defaults.
You can use the /NOEXECUTABLE or the /EXECUTABLE=NL: qualifier
to test a set of qualifiers, options, or input object modules,
without creating an image file. However, it is recommended that
you use /EXECUTABLE=NL:, because the linker will not process
certain other qualifiers if /NOEXECUTABLE is used.
/FULL
Produces a full memory allocation (map) listing; the /FULL
qualifier is valid only with /MAP qualifier.
A full listing contains the following information:
o All the information included in a brief listing (see the
description of the /BRIEF qualifier)
o Detailed descriptions of each program section and image section
in the image file
o Lists of global symbols by name and by value
/HEADER
Provides a system image header when used with the /SYSTEM qualifier. All other images always have headers. However, by default, system images do not have headers.
/INCLUDE
/INCLUDE=(module-name[,...])
Positional qualifier.
Selects modules from the associated object module library or image
library as input to the linking operation. No wildcard characters
are allowed in the module name specifications.
At least one module name must be specified. If you specify only
one module, you can omit the parentheses.
If you specify the /INCLUDE qualifier, you can also specify the
/LIBRARY qualifier; the library is then searched for unresolved
references.
/LIBRARY
Positional qualifier. Indicates that the associated input file is a library (default file type OLB) whose modules should be searched to resolve undefined symbols. You are not permitted to specify a library as the first input file unless you also specify the /INCLUDE qualifier to indicate which modules in the library are to be included in the input. If you use both the /INCLUDE and the /LIBRARY qualifiers, the explicit inclusion of modules occurs first, then the library is used to search for unresolved references.
/MAP
/MAP[=filespec]
/NOMAP
Controls whether a memory allocation listing (map) is produced
and gives you the option of assigning it a file specification. In
interactive mode, the default qualifier is /NOMAP; in batch mode,
the default qualifier is /MAP.
You can specify the map's contents using either the /BRIEF,
the /FULL, or the /CROSS_REFERENCE qualifier. If you do not
specify any of these qualifiers, the map contains the following
information:
o All the information contained in a brief listing (see /BRIEF)
o A list of user-defined global symbols by name
o A list of user-defined program sections
When you specify the /MAP qualifier, you can control the defaults
applied to the output file specification, as described in the VMS
DCL Concepts Manual.
/OPTIONS
Positional qualifier. Indicates that the associated input file (default file type OPT) contains a list of linking options. For complete details on the contents of an options file, see the VMS Linker Utility Manual.
/P0IMAGE
Creates an image that is stored only in P0 address space together with the stack and the VMS RMS buffers that usually go in P1 address space. The /P0IMAGE qualifier is used to create executable images that modify P1 address space. For a description of P0 and P1 address space, see the VAX Architecture Handbook.
/PROTECT
Creates a protected shareable image that can execute privileged change mode instructions even when it is linked to a nonprivileged executable image. The /PROTECT qualifier must be used together with the /SHAREABLE qualifier.
/SELECTIVE_SEARCH
Positional qualifier. Omits from the output image symbol table all symbols from the associated input object module that are not needed to resolve outstanding references. These symbols are also excluded from the symbol table file, if the /SYMBOL_TABLE qualifier is specified. The binary code in the object module is always included.
/SHAREABLE
/SHAREABLE[=filespec]
/NOSHAREABLE
Command qualifier.
Creates a shareable image file. By default, the linker creates
an executable image. Optionally, you can designate a name for the
output file; however, wildcard characters are not permitted.
Shareable images are not executable; however, they can be linked
with object modules to create executable images. If you specify
both the /EXECUTABLE and /SHAREABLE qualifiers, the /SHAREABLE
qualifier takes precedence.
When you specify the /SHAREABLE qualifier, you can control the
defaults applied to the output file specification by the placement
of the qualifier in the command.
To specify an input shareable image, the /SHAREABLE qualifier must
be used as an input file qualifier in an options file. See the
description of the linker in the VMS Linker Utility Manual.
/SHAREABLE
/SHAREABLE
/SHAREABLE=NOCOPY
Positional qualifier.
Identifies an input file as a shareable image file. The keyword
NOCOPY tells the linker not to bind a private copy of the
shareable image to the executable image. Use this positional
qualifier only within an options file. The /SHAREABLE and
/SHAREABLE=NOCOPY qualifiers are equivalent.
/SYMBOL_TABLE
/SYMBOL_TABLE[=filespec]
/NOSYMBOL_TABLE (default)
Controls whether a symbol table object module file (default file
type STB) is created that contains symbol definitions for all
global symbols in the image being linked. The symbol table file
can be subsequently specified in LINK commands to provide the
symbol definitions to other images.
If you specify the /DEBUG qualifier, the linker creates a separate
symbol table file and it includes within the image the global
symbol definitions that are used by the debugger.
When you specify the /SYMBOL_TABLE qualifier, you can control the
defaults applied to the output file specification. Optionally, you
can designate a name for the symbol table file, but you can not
use wildcard characters.
/SYSLIB
/SYSLIB (default)
/NOSYSLIB
Controls whether the default system libraries,
SYS$LIBRARY:IMAGELIB.OLB and then SYS$LIBRARY:STARLET.OLB, are
automatically searched for unresolved references in the input
files.
/SYSSHR
/SYSSHR (default)
/NOSYSSHR
Controls whether the default system shareable image library,
SYS$LIBRARY:IMAGELIB.OLB, is automatically searched for
unresolved references in the input files. By default, the
linker automatically searches the object module library
SYS$LIBRARY:STARLET.OLB and then SYS$LIBRARY:IMAGELIB.OLB when
it cannot resolve references in the input files.
/SYSTEM
/SYSTEM[=base-address]
/NOSYSTEM (default)
Controls whether a system image is produced. The /SYSTEM qualifier
produces a system image and optionally assigns it a base address.
You cannot use the /SYSTEM qualifier with either the /SHAREABLE
qualifier or the /DEBUG qualifier. A system image cannot be run
with the RUN command; it must be bootstrapped or otherwise loaded
into memory.
The base address specifies where the image is to be loaded in
virtual memory. It can be expressed in decimal, hexadecimal,
or octal format, using the radix specifiers %D, %X, or %O,
respectively. The default base address is %X80000000.
System images are intended for special purposes, such as stand-
alone operating system diagnostics. When the linker creates a
system image, it orders the program sections in alphanumeric order
and ignores all program section attributes.
/TRACEBACK
/TRACEBACK (default)
/NOTRACEBACK
Controls whether traceback information is included in the image
file to help the system trace the call stack when an error occurs.
If you specify the /DEBUG qualifier, the /TRACEBACK qualifier is
assumed.
/USERLIBRARY
/USERLIBRARY[=(table[,...])]
/USERLIBRARY=ALL (default)
/NOUSERLIBRARY
Specifies which user-defined default libraries (process, group,
system or, by default, all three) the linker searches after it
has searched any specified user libraries. (The discussion of
the linker in the VMS Linker Utility Manual explains user-defined
default libraries.) You can specify the following tables for the
linker to search:
ALL By default, the linker searches the process, group,
and system logical name tables for user-defined library
definitions.
GROUP The linker searches the group logical name table for
user-defined library definitions.
NONE The linker does not search any logical name table; this
specification is equivalent to using the /NOUSERLIBRARY
qualifier.
PROCESS The linker searches the process logical name table for
user-defined library definitions.
SYSTEM The linker searches the system logical name table for
user-defined library definitions.
The /NOUSERLIBRARY qualifier tells the linker not to search any
user-defined default libraries.
Examples
1. $ LINK ORION
The LINK command in this example links the object module in the
file ORION.OBJ and creates an executable image named ORION.EXE.
2. $ LINK/MAP/FULL DRACO,CYGNUS,LYRA
The LINK command in this example links the modules DRACO.OBJ,
CYGNUS.OBJ, and LYRA.OBJ and creates an executable image named
DRACO.EXE. The /MAP and /FULL qualifiers request a full map of
the image, with descriptions of each program section, lists of
global symbols by name and by value, and a summary of the image
characteristics. The map file is named DRACO.MAP.
3. $ LINK [SSTEST]SERVICE/INCLUDE=DRACO, -
_$[]CYGNUS/EXECUTABLE
The LINK command in this example links the object module DRACO
from the library SERVICE.OLB in the directory SSTEST with
the module CYGNUS.OBJ in the current default directory. The
executable image is named CYGNUS.EXE. The placement of the
/EXECUTABLE qualifier provides the output file name default.
4. $ LINK/MAP/CROSS_REFERENCE/EXECUTABLE=DBGWEATH -
_$/DEBUG -
_$WEATHER,MATHLIB/LIBRARY
$ RUN DBGWEATH
VAX DEBUG V5.4
%DEBUG-I-INITIAL, language is FORTRAN, module set to 'WEATHER'
DBG>
The LINK command in this example links the object module
WEATHER.OBJ with the debugger. If any unresolved references
are encountered, the linker searches the library MATHLIB.OLB
before searching the system library. The /CROSS_REFERENCE
qualifier requests a cross-reference listing in the map
file; the map file is named, by default, WEATHER.MAP. The
/EXECUTABLE qualifier requests the linker to name the output
file DBGWEATH.EXE. The RUN command executes the image; the
message from the debugger indicates that it is ready to accept
debug commands.