Combine Static Libraries (OS/2, Windows)

You should create a static library by building from the IDE or by issuing the vacbld command. A build creates a new library from scratch. You cannot specify the same library file as a source and a target in your configuration file. Therefore, in a build you cannot combine libraries and produce a library that has the same name as one of the input libraries. If you want to merge two or more libraries you can build a new library by specifing the existing libraries as sources and a new library as the target.

If you do not want to perform a build, or want the library produced to have the same name as one of the existing libraries, use the ilib command. However, consider that when you change a library with ilib, the utility does not update the codestore and subsequent builds may not have the desired results.

To combine existing libraries, follow these steps:

  1. In the VisualAge C++ command line window, open a working directory.
  2. Issue the ilib command. Use the /out:fileName option to tell ilib to output a library. If you do not specify the name of the output library, it is given the same base name as the first input file and extension .lib. If you specify the name of the output library, repeat the library name as an input file.

For example, the following command adds the object modules in nights.lib to the library days.lib.

ilib /out:days.lib days.lib nights.lib

Modules are identified by their name. If a module is present in more than one of the libraries being combined, the first module is used and ilib outputs as message. The existing libraries, except the output library, are not changed.

You can perform several tasks in one run of ilib. For example the following command combines the libraries library pets.lib and fish.lib. At the same time it copies the module dogs from the library to the current directory and deletes the module birds from the library.

    ilib /out:pets.lib fish.lib /extract:dogs /remove:birds



Static and Dynamic Link Libraries
Maintaining Libraries


List the Contents of a Static Library
Add an Object Module to a Static Library
Replace an Object Module in a Static Library
Extract an Object Module from a Static Library
Remove an Object Module from a Static Library


The ilib Command