KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q64437: A.P.T. Omits /NOI Requirement for Linking with C Run-Time DLL

Article: Q64437
Product(s): See article
Version(s): 6.00 6.00a | 6.00 6.00a
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | docerr | mspl13_c
Last Modified: 19-JAN-1991

On Page 412 of the "Advanced Programming Techniques" manual that
shipped with C version 6.00 and 6.00a, there are examples of compile
and link lines for building a program that calls a DLL version of the
C run-time library. The LINK command-line fails to include the /NOI
option, which is necessary for the program to load properly.

The linker can resolve calls to the run-time DLL without /NOI because
the import library contains the function names needed, but then the
linker will write out the function names to the .EXE with the wrong
case. For example, if a program calls printf() and it is linked
without /NOI, it will have _PRINTF written to the .EXE. The loader
will then look for _PRINTF in the DLL, while the actual function in
the DLL is _printf.

As a result, everything seems to compile and link correctly, but when
you try to run the program, you will get a SYS2070 error: The system
could not demand load the application segment.

If you build from within the Programmer's WorkBench (PWB), the /NOI is
inserted automatically and everything works correctly.

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.