How the Linker Searches the Libraries

Last reviewed: January 24, 1995
Article ID: Q31998
The information in this article applies to:
  • Microsoft LINK for MS-DOS, versions 3.x 5.0x 5.1x 5.3x 5.5 and 5.6
  • Microsoft LINK for Windows NT, versions 1.0 and 2.5

The linker searches for unresolved externals in the following order:

  1. Find all modules in the library that define current unresolved externals.

  2. Process those modules (you may pickup more unresolved externals). The linker keeps making passes through that library until no new unresolved externals are picked up.

  3. It then advances to the next library.

In a similar manner, the linker makes a pass through the entire set of libraries. After the last library is searched, if new unresolved externals have been picked up, it returns to the first library and makes another pass.

Problems can be avoided if you do not use bidirectional cross-library references (that is, avoid library A calling something in library B that calls something else in library A). Try to make each library as self-contained as possible.


Additional reference words: kbinf 5.50 5.60 1.00 2.50
KBCategory: kbtool
KBSubcategory: LinkIss


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: January 24, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.