Extract an Object Module from a Static Library (OS/2, Windows)

A static library contains one or more object modules. After you have built a library you can extract from it, to get a copy of the module in a object file.

To extract a module from an existing library, follow these steps:

  1. In the VisualAge C++ command line window, open a working directory.
  2. Issue the ilib command. List the library on the command line, as an input file. After the input files, specify /extract: followed by the name of the module to be copied. The short form /e is equivalent to /extract. Do not specify a path or extension for the object module.

For example, the following command extracts the module sample.obj from the library mylib.lib.

ilib mylib.lib /extract:sample

The module is not deleted from the library. A copy of it is put in the current working directory or in the directory specified by an absolute path specified with the file name. If an object file with the same name already exists in the directory, ilib overwrites it.

You can perform several tasks in one run of ilib. For example the following command adds the module cats.obj to the library pets.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 cats.obj /extract:dogs /remove:birds



Static and Dynamic Link Libraries
Maintaining Libraries


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


The ilib Command