18.4.2 Generating an Import Library with IMPLIB

Summary: The DLL exports a procedure; the client program imports it.

Just as a procedure is exported by a DLL, it must be imported by an application. An application's EXE header must indicate what dynamic-link procedures are used and where they reside. The easiest way to specify this information is with an “import library,” which is a .LIB file that contains the import information in object-record form. The IMPLIB utility automates this process for you.

To create an import library, run the IMPLIB utility on the module-definition file:

IMPLIB MYDYNLIB.LIB MYDYNLIB.DEF

The result is the import library, MYDYNLIB.LIB, which you then link to any program that calls CSTR.DLL. You would then list MYDYNLIB.LIB in the libraries field (the fourth field) of the LINK command. Or, in assembly-language programs, you can link to this library automatically by just adding the following statement to the source code of your program:

INCLUDELIB MYDYNLIB.LIB