KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q35031: Unresolved Externals when Linking for Protected Mode

Article: Q35031
Product(s): See article
Version(s): 5.10   | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 12-OCT-1988

Problem:

I am compiling my C program for protected-mode with the command:

cl /Lp demo.c

I'm using the Microsoft Segmented-Executable Linker Version
5.01.04, but at link-time I get about 10 unresolved externals,
all of which are OS/2 API calls such as DOSWRITE, DOSCLOSE,
DOSEXIT.

If I link in the library DOSCALLS.LIB, as follows, the problem is
corrected:

cl /Lp demo.c doscalls.lib

The manual does not state that DOSCALLS.LIB must be explicitly linked.

Response:

This problem occurs because you are using the wrong version of the
Microsoft Segmented-Executable Linker. You should be using Version
5.01.21, which was distributed with C Version 5.10. Version 5.01.04 is
the OS/2 linker.

You must link in DOSCALLS.LIB with Version 5.01.04 because this
version of LINK does not have the ability to bring in libraries that
are themselves requested by a library.

The library xLIBCyP.LIB (where x is the memory model and y is the math
package) contains a request for DOSCALLS.LIB. Link Version 5.01.21
understands this request and searches for DOSCALLS.LIB in the
directories specified in the LIB environment variable; LINK Version
5.01.04 does not understand this request.

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.

Copyright Microsoft Corporation 1986-2002.