Programming Tools:prgtools

Linker options Foundation

The linker options pass information to ALINK specifying how an excutable file is created. It uses keywords which are always preceded by a slash. Linker options can be specified at any place on the command line, and some of the key words can be abbreviated.

/BASE:<n>

With the option /BASE:<n>, the linker sets the specified base address for loading the executable file. Default values are 0x400000 for EXE files and 0x10000000 for DLL files. If the operating system is not able to load a file at the specified location, it calculates a new base address and relocates the program. Information about base addresses can be obtained by using the /MAP option. Base addresses are then listed in a MAP file. The linker rounds the value <n> to a multiple of 64kB.

/DE[BUG]

With option /DEBUG, the linker imports debug information, such as symbol names and line numbers, into the EXE file. The EXE file can still be executed outside of the debugger. Within the debugger, this information is available only when the application has been linked with the /DEBUG option.

Important: To receive debug information from the compiler, PRG files must be compiled with the /b switch. A debug-enabled EXE file can be created only by using the compiler option /b along with the linker option /DEBUG.

/DEFAULTLIB:<file>

This option specifies an additional LIB file in which the linker is to search for resolving external references. The linker first searches the libraries specified on the command line, then the /DEFAULTLIB libraries and finally those named in OBJ files.

/DLL

With this option, the linker creates a DLL file instead of an EXE file. All OBJ files to be linked to a DLL must be compiled using the /dll switch of the compiler.

When using the option /DLL, not only OBJ files but also the export definition file (EXP file) must be specified to the linker (see Creating DLL files).

/FORCE:MULTIPLE | UNRESOLVED

The option /FORCE forces the linker to produce an executable file even if it has detected unresolved external symbols and/or multple declarations of the same sysmbol. The executable file is then not correct and only those parts of the program that do not use the symbols in question may run error free.

If the linker should tolerate both unresolved symbols and multiple declarations of one symbol, the /FORCE switch must be used twice (Alink <file> /FORCE:MULTIPLE /FORCE:UNRESOLVED).

we strongly discourage you from using the /FORCE option. If you use it, you must be aware that the output file may be incorrect. To run an incorrect program can lead to a crash of the program and/or the operating system.

/MAP[:<file>]

The /MAP option causes the linker to create a MAP file. This file contains information about the executable file. Optionally, the MAP file name can be specified with <file>. If it is omitted, the output file name is used for the MAP file.

/NOD[EFAULTLIB]

This option prevents ALINK from searching default import libraries which resolve external references, such as the file XPPRT1.LIB, for example. When this option is used, the linker only uses the LIB files specified on the command line.

/NOL[OGO]

This option suppresses the display of the program logo and version number.

/NOSWAP

By default binaries are fully loaded and copied to the local swap file (Windows VMM). Using the option /NOSWAP binaries are not copied into the local swap file, instead reloads of binary data occur from the originating storage device. If the device is removeable and gets removed or the network is disconnect the application process may die silently.

/OUT:<file>

The name of the executable file can be defined with this option. By default, the file name is created from the first OBJ file specified to the linker.

/PM[TYPE]:VIO|PM [<major>[.<minor>]]

/SUBSYSTEM:CONSOLE|WINDOWS [<major>[.<minor>]]

The /SUBSYSTEM and /PMTYPE options have the same meaning for the linker. They define the application type. The default is VIO or CONSOLE, respectively, which indicates a text mode application. If PM or WINDOWS is specified, the linker creates a GUI application.

Optionally, the minimum version number of the operating system required for an Xbase++ application to be executed can be specified. If <major> is set to 4 and <minor> to .1, for example, an Xbase++ program could not be started on an operating system version 3.x but it would run on a 5.x version.

/ST[ACK]:<max>[,<min>]

This option sets the stack size of an Xbase++ application. <max> is a numeric value indicating the maximum stack size in bytes (default is 1 MB), while <min> optionally defines the stack size at program start. This means that the minimum stack size is <min> bytes and it can grow dynamically at runtime to a maximum size of <max> bytes.

/VERBOSE

The option /VERBOSE causes the linker to display additional information during the link process.

/VERSION <major>[.<minor>]

The linker puts this version information into the header of the EXE or DLL file. <major> and <minor> may contain a value from 0 to 65535.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.