QLINK Documentation File
Version 5.08
23 March 2006

Overview

QLINK is a DOS linker and analysis tool designed to link together MS-DOS compatible .OBJ files.  It can replace the MS-DOS LINK.EXE program when producing MS-DOS compatible .EXE and .COM files.

Installation

Make a directory (e.g., C:\QLINK), copy the zip file to that directory, and unzip the files:

MD C:\QLINK
CD C:\QLINK
COPY A:\QLINK.ZIP
PKUNZIP QLINK.ZIP

If you'll be running QLINK under Windows 3.1x (see below for Win95 instructions), copy the file WINDPMI.386 to your Windows system directory.  For example, if you installed Windows into the directory C:\WINDOWS, copy WINDPMI.386 to C:\WINDOWS\SYSTEM.  Then edit your Windows SYSTEM.INI file to insert a line such as the following in the [386ENH] section:

    device=windpmi.386

You should first ensure that no other similar line already appears in your SYSTEM.INI file.  For example, you might already have a line such as

    device=c:\bc4\bin\windpmi.386

If this is the case, do not insert another call to the same driver; you need only one. This VxD does not work with Win9x.

If you'll be running QLINK under Win9x, follow the above procedure using the file W95DPMI.386 instead of WINDPMI.386.

Benefits

System Requirements

How To Use

For the most part, just call QLINK instead of LINK or TLINK as appropriate.  Borland users should note that a number of Borland specific Object Module Formats (OMFs) are not implemented as yet (I'm waiting for the documentation from Borland).  Several MS link switches are not supported as yet (e.g., /PACKC).  If there are switches you particularly need which are not supported, let me know.  For an explanation of the old linker switches, see your linker manual.

Tips

To take advantage of the detailed error processing in QLINK, use the assembler switches which generate types and line numbers.  For MASM and TASM these switches are /Zd and /Zi.

Segment Ordering

The order in which segments appear in the executable file depends on several factors.  The first is whether or not the /DOSSEG switch appears explicitly on the command line or implicitly in a OMF record in one of the .OBJ files.

If /DOSSEG is specified, the segment order is as follows:

Otherwise, the segment order is as follows:

Error Messages

There are a number of switches specific to QLINK which are documented in the file QLINK.CFG.  These switches control the processing of error messages from QLINK.   All error messages begin with either

==> WARN:

or

==> FAIL:

Messages which begin with WARN are warnings and do not halt the linker.  Messages which being with FAIL cause the linker to stop immediately and not continue processing the input files.

If an error message is followed by a name such as FIXOVF or GRPEXT0 in parentheses, then that error can be controlled by the switches /I:switch, /W:switch, and /F:switch, where switch is the name in parentheses in the error message.

If you wish to ignore this error (meaning the linker takes a default action and continues processing), use /I:switch.  To warn about an error (meaning an error message is displayed, the linker takes a default action, and continues processing), use /W:switch.  The default settings for all error messages are described in the file QLINK.CFG.

This same file (QLINK.CFG) is consulted when QLINK begins execution.  Any switches found there (including switches such as /MAP, /LINE, etc.) are processed before the command line is parsed.  Switches only may be contained in QLINK.CFG, not names of .OBJ files, etc.  Even earlier in the process, the environment variable QLINK= is consulted, and it too may contain only switches.

Thus the order of processing of switches is first, those contained in the environment variable QLINK=, then those in the file QLINK.CFG (first in the current directory, and if not found there in the directory from which QLINK is loaded), and finally those found on the command line to QLINK.  Switches processed later in the sequence override ones processed earlier.

Name Substitutions

Occasionally, you want to link together .OBJ modules from different projects which use different naming conventions.  For example, in one project code segments are in class CODE and in others they are in class PROG.  Previously, you would have to edit the source code, make the changes, and re-compile.  With the Name Substitution feature of QLINK, it's a snap.

To substitute names on the fly within the .OBJ file, place the switch /NS before the reference to each .OBJ file whose names are to be substituted.  For example, use /NS:PROG-CODE to tell QLINK that the name PROG is to be changed to CODE.

Each substitution is effective for all .OBJ files which appear after it until that substitution (or all substitutions) are halted.  Use the form /NS:name to halt substitutions on name; use /NS with no arguments to halt all substitutions.

Note that this means that the occurrences of /NS are sensitive to the position and order in which they appear.  Be sure to place occurrences of /NS before the reference to the .OBJ file to which they apply.

To swap two symbols in the same file, use (say) /NS:A-B:B-A.

The substitution is made on all references to the name regardless of context.  Thus if you have a file with a segment named PROG and a class named PROG, substituting CODE for PROG changes both references.

The full syntax is

Nameset:   (empty)                 ; Halt substitution on all names
          | name                   ; Halt substitution on this name
          | name '-' name          ; Substitute the second name for the first name

Namedef:    Nameset
          | Namedef ':' Nameset

Switch:     '/NS:' Namedef

The keyword /NS may appear in the QLINK environment variable, the QLINK.CFG configuration file, the automatic response file, and the QLINK command line.

Frequently Asked Questions

Q:  When I link modules with the MS linker and QLINK, sometimes the executable files are of very different sizes?
A:  This can occur if a .LIB is used to resolve external references.  Because there is no rule as to the order in which external refs are processed, different ordering of these references mean that there can be different segment boundary alignments which can change the final executable file size.

Future Work

In no particular order of importance (nor of expectation of getting done), the following topics are on my list:

Please feel free to add to this list.

Source Code

The source code for QLINK may be viewed as a web page, or accessed directly by a Subversion (SVN) client if you have one on your local machine.

Technical Support

Please contact the author via Internet e-mail at

    (Bob Smith)

QLINK is © Copyright 1994-2006 Qualitas, Inc.  All rights reserved.

Change History

5.08    23 March 2006

5.07    2 January 2004

5.06    24 December 2003

5.05    19 June 2003

5.04    22 May 2003

5.03    21 July 2002

5.02    1 July 2002

5.01    26 June 2002

5.00    26 June 2002

1.30    22 June 2002

1.29    18 April 2002

1.28    25 April 2000

1.27    18 April 2000

1.26    10 April 2000

1.25    7 April 2000

1.24    4 April 2000

1.23    30 March 2000

1.22    30 March 2000

1.21    28 March 2000

1.20    24 March 2000

1.19    22 March 2000

1.18    15 March 2000

1.17    2 October 1999

1.16    8 September 1999

1.15    6 September 1999

1.14    3 September 1999

1.13    25 May 1999

1.12    16 May 1999

1.11    25 June 1998

1.10    27 April 1998

1.09    12 March 1998

1.08    12 November 1997

1.07    8 July 1997

1.06    25 June 1995

1.05    8 May 1995

1.04    25 March 1995

1.03    14 February 1995

1.02    18 November 1994

1.01    26 October 1994

1.00    2 October 1994