12.1 Overview

LINK combines 80x86 object files into either an executable file or a dynamic-link library (DLL). The object-file format is the Microsoft Relocatable Object-Module Format (OMF), based on the Intel 8086 OMF. LINK uses library files in Microsoft library format.

LINK creates “relocatable” executable files and DLLs—that is, the operating system can load and execute these files in any unused section of memory. LINK can create DOS executable files with up to 1 megabyte of code and data (or up to 16 megabytes when using overlays), or OS/2 and Microsoft Windows programs with up to 16 megabytes.

For more information on OMF, executable-file format, and the linking process, see the MS-DOS Encyclopedia.

Summary: Use BIND to create an OS/2 program that also runs under DOS.

The linker produces programs that run under DOS only or under OS/2 only, but not both. However, if an OS/2 program limits its OS/2 function calls to the Family API subset, you can use the Microsoft Bind Utility (BIND) to modify the OS/2 executable file so that it runs under both OS/2 and DOS. For more information, see online help.

Summary: Use EXEHDR to examine the finished file.

When the file (either executable or DLL) is created, you can examine the information that LINK puts in the file's header by using the Microsoft EXE File Header Utility (EXEHDR). For more information, see online help.

Summary: Other programs can call LINK automatically.

The Programmer's WorkBench (PWB) invokes LINK to create the final executable file or DLL. Therefore, if you develop your software with PWB, you might not need to read this chapter. However, the detailed explanations of LINK options might be helpful when you use the LINK Options dialog box in PWB. This information is also available in online help.

The compiler or assembler supplied with your language (CL with C, FL with FORTRAN, ML with MASM) also invokes LINK. You can use most of the LINK options described in this chapter with this utility. Online help has more information about the compilers and assembler: select help for the appropriate language from the Compiler box of the help Contents screen.

NOTE:

Unless otherwise noted, all references to “library” in this chapter refer to a static library, either a standard library created by the Microsoft Library Manager (LIB) or an import library created by the Microsoft Import Library Manager (IMPLIB), and not a DLL.