Linker Can Indiscriminately Bind Different Types

Last reviewed: July 17, 1997
Article ID: Q48204
1.x 2.x 3.x 4.x 5.x MS-DOS kbtool

The information in this article applies to:

  • Microsoft LINK for MS-DOS, versions 1.x, 2.x, 3.x, 4.x, 5.01, 5.02, 5.03, 5.05, 5.1, 5.11, 5.13, 5.15, 5.3, 5.31.009, 5.5, and 5.6

The object module format used by the Microsoft languages contains a record type that is used to bind symbol definitions to symbol references in other modules. This record is known as a "fixup." As defined by Intel, the fixup record type contains no information as to the type of data that is to be fixed up. Under certain circumstances, this can cause unexpected and undesired binding at link time. The code below demonstrates such an instance:

    /*----- FILE1.C -----*/

    void bar( void );

    void main( void )
    {
        bar();
    }


    /*----- FILE2.C -----*/

    int bar;

These files both compile without error. When compiled for a model with a single code segment, linker error L2003 is produced saying that an intersegment self-relative fixup was attempted. If a multiple code segment model is used, no link errors are produced. Although a clean link can be obtained, the resultant EXE does not perform as expected due to the fact that the function reference of bar in FILE1.C has been bound to the integer definition of bar in FILE2.C.

The linker has no way of determining the types of the reference to, and definition of, bar. This is a limitation of the object file format. If an include file was used to prototype bar and was then included in both files, the compiler could have detected the redefinition of bar.

This information applies to all versions of LINK.


Additional reference words: kbinf 3.60 3.61 3.65 4.06 4.07
KBCategory: kbtool
KBSubcategory: LinkIss
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.