The objfiles Field

The objfiles field specifies one or more object files to be linked. At least one filename must be entered. If you do not supply an extension, LINK assumes a default .OBJ extension. If the filename has no extension, add a period (.) to the end of its name.

If you name more than one object file, separate the names with a plus sign (+) or a space. To extend objfiles to the following line, type a plus sign (+) as the last character on the current line, then press ENTER, and continue. Do not split a name across lines.

How LINK Searches for Object Files

When it searches for object files, LINK looks in the following locations in the order specified:

1.The directory specified for the file (if a path is included). If the file is not in that directory, the search ends.

2.The current directory.

3.Any directories specified in the LIB environment variable.

If LINK cannot find an object file, and a floppy drive is associated with that object file, LINK pauses and prompts you to insert a disk that contains the object file.

Load Libraries

If you specify a library in the objfiles field, it becomes a “load library.” LINK treats a load library like any other object file. It does not search for load libraries in directories named in the libraries field. You must specify the library's filename extension; otherwise, LINK assumes an .OBJ extension.

LINK puts every object module from a load library into the executable file, regardless of whether a module resolves an external reference. The effect is the same as if you had specified all the library's object-module names in the objfiles field.

Specifying a load library can create an executable file or DLL that is larger than it needs to be. (A library named in the libraries field adds only those modules required to resolve external references.) However, loading an entire library can be useful when:

Repeatedly specifying the same group of object files.

Placing a library in an overlay.

Debugging so you can call library routines that would not be included in the release version of the program.

Overlays

A special syntax for the objfiles field lets you assign the contents of object files to specific overlays in a DOS program. To place one or more object files in an overlay, enclose the filenames in parentheses. This syntax may not be supported in future versions of LINK. For more information about overlays, see Chapter 15.