Create An Import Library and Export Object (OS/2, Windows)

When you build a module that uses a DLL, you usually link the module with the import library for the DLL.  Import libraries are now created automatically when you create a DLL that contains exportable symbols with a VisualAge C++ build, and this is the best way to get an import library.

In previous versions of VisualAge C++ and predecessor products, you had to perform extra steps when you built a DLL to also build the import library.
In previous versions of VisualAge C++ for OS/2 3.0 and IBM C and C++ Compilers 3.6  you used the implib utility to create the import library from the module definition file.
In previous versions of VisualAge for C++ for Windows version 3.5 and IBM C and C++ Compilers 3.6 you also had to create an export object (.exp) file as part of the process of building a DLL. Supplying a module definition file was optional on Windows.
Module definition (.def) and export object (.exp) files are no longer required.

You may want to create an import library without building a DLL in order to migrate DLLs from earlier versions of VisualAge C++ and predecessor products, or because you have an existing DLL and .def file but no import library.

You can use the ilib command to create an import library and an export object file. These two files are always output together. To create these files:

  1. Have an existing module definition file for a DLL. You can also use object modules that were generated from C or C++ sources that export symbols explicitly, or a combination of objects modules and a .def file.
  2. In a VisualAge C++ command line window, open a working directory.
  3. Issue the ilib command. Use the /genimplib:fileName. If you omit the file name, the import library file has the same base name as the first input file and the extension .lib. The short form /gi is equivalent to /genimplib. Also list the input .def file or object modules on the command line.

For example, the following command creates an import library and an export object file. The outut files are called winner.lib and winner.exp, because the file name is taken from the input .def file.

ilib /gi winner.def

If the library contains no exported symbols, no import library is produced, but an export object file is produced.



Static and Dynamic Link Libraries
.def and .exp Files are Obsolete
Maintaining Libraries


Build Dynamic Link Libraries
Build Modules That Use DLLs
Export Symbols from a DLL


The ilib Command