General syntax:
link [/options] objfile [objfile] [libfile.lib], [exefile], [mapfile], [libfile] [libfile] [;]
Options
/BATCH
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.
/CODEVIEW
Adds extra debugging info to the executable file. Necessary when preparing a program for debugging with CodeView.
/EXEPACK
Compresses repeated character strings to reduce the executable file size. A very primitive (built-in, at least...) executable file packer.
/FARCALLTRANSLATE
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."
/HELP
Shows a brief list with all the available commands.
/INFO
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.
/LINENUM
Needed if the program was compiled using the /zd switch, for debug purposes (using SYMDEB)
/MAP
Includes in the output map file (if provided) all of the public symbol names.
/NODEFAULTLIB
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.
/NOEXTDIC
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.
/NOFARCALL
LINK will not translate far calls to near ones. (See /FARCALLTRANSLATE)
/NOLOGO
Avoids the display of the copyright notice.
/NOPACKCODE
Explicitally avoids the compression of the executable file. (See /EXEPACK)
/OVERLAYINT
Specifies a different interrupt number to be used to invoke the overlay manager. Default: INT &H3F.
/PACKCODE
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.
/PAUSE
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.
/QUICKLIB
Defines that we're making a quicklibrary (.QLB) instead of a standard executable file (.EXE)
/SEGMENTS:n
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.
/STACK:n
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.