LINK Ignores Drive Specification When Searching for Libraries

ID Number: Q66699

5.01.21 5.03 5.05 5.10 5.11 5.13 | 5.01.21 5.03 5.05 5.10 5.11 5.13

MS-DOS | OS/2

Summary:

A library name can be embedded into an object module (.OBJ) for LINK

to use when searching to resolve external references. This library

name can either be the library name itself or the full path to the

library. In the case of a full path to the library, LINK does not use

the drive specifier.

More Information:

If a drive specifier is present in a library name embedded in an .OBJ,

it is intentionally ignored by the linker. This is done to provide

compatibility with older compilers that automatically attached the

drive letter to all library records. Therefore, if a library is not

located on the default drive, LINK will prompt for its location.

For example, with Microsoft C, the #pragma comment command is used to

specify the library. If the following line is used

#pragma comment (lib, "E:\C600\LIB\GRAPHICS.LIB")

the compiler will add a COMENT record to the .OBJ instructing LINK to

search the C600\LIB subdirectory for the library GRAPHICS.LIB. If the

current default drive happens to be drive C, then LINK will search

drive C for the C600\LIB directory. When the library and/or path is

not found, it will prompt for the path to the library.