The default mode for LIB is to build or modify a library of COFF objects. LIB runs in this mode when you do not specify /EXTRACT (to copy an object to a file) or /DEF (to build an import library).
To build a library from objects and/or libraries, use the following syntax:
The options that apply to building and modifying a library are listed in the following table:
Option | Description |
---|---|
/CONVERT | Converts an import library to the previous (Visual C++ version 5.0) format. |
/LIBPATH:dir | Overrides the environment library path. For more information, see the linker option /LIBPATH. |
/LIST | Displays information about the output library to standard output. The output can be redirected to a file. You can use /LIST to determine the contents of an existing library without modifying it. |
/LINK50COMPAT | Generates an import library in the previous (Visual C++ version 5.0) format for backwards compatibility. |
/OUT:filename | Overrides the default output filename. By default, the output library has the base name of the first library or object on the command line and the extension .LIB. |
/REMOVE:object | Omits the specified object from the output library. LIB creates an output library by first combining all objects (whether in object files or libraries), then deleting any objects specified with /REMOVE. |
/SUBSYSTEM | Tells the operating system how to run a program created by linking to the output library. For more information, see the description of the LINK /SUBSYSTEM option in Compiler and Linker Options. |
Other LIB options are described in:
The files can be COFF object files, 32-bit OMF object files, and existing COFF libraries. LIB creates one library that contains all objects in the specified files. If an input file is a 32-bit OMF object file, LIB converts it to COFF before building the library. LIB cannot accept a 32-bit OMF object that is in a library created by the 16-bit version of LIB. You must first use the 16-bit LIB to extract the object, then you can use the extracted object file as input to the 32-bit LIB. The 16-bit version of LIB is not provided with Visual Fortran.
By default, LIB names the output file using the base name of the first object or library file and the extension .LIB. If a file already exists with the same name, the output file overwrites the existing file. To preserve an existing library, use the /OUT option to specify a name for the output file.
You can use LIB to perform the following library-management tasks:
Specify the filename for the existing library and the filenames for the new objects.
Specify the library filenames. You can add objects and combine libraries in a single LIB command.
Specify the library containing the member object to be replaced and the filename for the new object (or the library that contains it). When an object that has the same name exists in more than one input file, LIB puts the last object specified in the LIB command into the output library. When you replace a library member, be sure to specify the new object or library after the library that contains the old object.
Use the /REMOVE option. LIB processes any specifications of /REMOVE after combining all input objects, regardless of command-line order.