link [/options] objfile [objfile] [libfile.lib], [exefile], [mapfile], [libfile] [libfile] [;]
Enables Batch Mode: the linker will not pause and prompt for library names that's unable to find. Instead, it'll show a warning message.
Adds extra debugging info to the executable file. Necessary when preparing a program for debugging with CodeView.
Compresses repeated character strings to reduce the executable file size. A very primitive (built-in, at least...) executable file packer.
Replaces far calls with near calls, if the target address is close enough to be accessed via a near call. Useful when using /PACKCODE.
Some interesting comments from Mr. Ethan Winer about this switch:
"By default, all calls from BASIC to its runtime library routines are far calls, which means that both a segment and address are needed to specify the location of the routine being accessed. Assembly language and C routines meant to be used with BASIC are also designed as far calls, as are BASIC subprograms and functions. This affords the most flexibility, and also lets you create programs larger than could fit into a single 64K segment.
Within the BASIC runtime library there are both near and far calls to other library routines. Which is used depends on the routines involved, and how the various segments were named by the programmers at Microsoft. Because a far call is a five-byte instruction compared to a near call which is only three, a near call requires less code and can execute more quickly. In many cases, separate code segments that are less than 64K in size can be combined by LINK to form a single segment. The routines in those segments could then be accessed using near calls. However, BASIC always generates far calls as it compiles your programs.
The improvement /f affords is further increased by also using the /packcode switch. Although the far call is replaced with a near call, LINK can't actually reduce the size of the original instruction. Instead it inserts a NOP (no operation) assembly language command where part of the far call had been. But since a near call does not require segment relocation information in the .EXE file header, the file size may be reduced slightly."
Shows a brief list with all the available commands.
Shows the linking process on screen, ie: the name of each object file being linked is displayed, as are the routines being read from the libraries.
Needed if the program was compiled using the /zd switch, for debug purposes (using SYMDEB)
Includes in the output map file (if provided) all of the public symbol names.
Tells LINK not to use the library name embedded within the object file, which of course means that you must specify a library name manually.
If LINK finds more than one occurrence of a public name, it'll use the routine or data item it finds first, avoiding to issue an error message.
LINK will not translate far calls to near ones. (See /FARCALLTRANSLATE)
Avoids the display of the copyright notice.
Explicitally avoids the compression of the executable file. (See /EXEPACK)
Specifies a different interrupt number to be used to invoke the overlay manager. Default: INT &H3F.
Combines multiple adjacent code segments into as few larger ones as possible. Useful when using /FARCALLTRANSLATE. Check /FARCALLTRANSLATE to read some interesting comments about these switches.
Pauses after reading and processing the object and library files, but before writing the final executable program to disk. This is useful only when no hard drive is available, and all of the files will not fit onto a single floppy disk.
Defines that we're making a quicklibrary (.QLB) instead of a standard executable file (.EXE)
Specifies to reserve memory for n segment names. The default number of segment names is 128, and if when linking your program you get the "Too many segments" error, try again increasing that number.
Specifies the size of BASIC's stack, where n is a block of bytes to be set aside in DGROUP for use as a stack.
Document compiled by Hexadecimal Disaster.