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

ID Number: Q64437

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

docerr

Summary:

On page 412 of the "Microsoft C Advanced Programming Techniques"

manual that shipped with C versions 6.0 and 6.0a, there are examples

of compile and link lines for building a program that calls a DLL

(dynamic-link library) 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.

More Information:

The linker can resolve calls to the run-time DLL without /NOI because

the import library contains the function names needed; however, then

the linker writes out the function names to the .EXE using 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

then looks for _PRINTF in the DLL, while the actual function in the

DLL is _printf.

As a result, everything apparently compiles and links correctly, but

when an attempt is made to run the program, a SYS2070 error is

received, "The system could not demand load the applications segment."

If you build from within the Programmer's WorkBench (PWB), the /NOI is

inserted automatically and everything works correctly.

Additional reference words: 6.0ax 6.00 6.00a 6.00ax