Muokkaa

Jaa


Running LIB

Various command-line options can be used to control LIB.

LIB Command Line

To run LIB, type the command lib, followed by the options and file names for the task you're using LIB for. LIB also accepts command-line input in command files, which are described in the following section. LIB doesn't use an environment variable.

LIB Command Files

You can pass command-line arguments to LIB in a command file using the following syntax:

LIB @command-file

The file command-file is a text file. No spaces or tabs are allowed between the at sign (@) and the file name. The command-file name has no default extension. Specify the full file name, including any extension. Wildcards can't be used. You may specify an absolute or relative path with the file name.

In the command file, arguments can be separated by spaces or tabs, as they can on the command line. Arguments can also be separated by newline characters. Use a semicolon (;) to mark a comment. LIB ignores all text from the semicolon to the end of the line.

You can specify either all or part of the command line in a command file, and you may use more than one command file in a LIB command. LIB accepts the command-file input as if it's specified in that location on the command line. Command files can't be nested. LIB echoes the contents of command files unless the /NOLOGO option is used.

Using LIB Options

An option consists of an option specifier, which is either a dash (-) or a forward slash (/), followed by the name of the option. Option names can't be abbreviated. Some options take an argument, specified after a colon (:). No spaces or tabs are allowed within an option specification. Use one or more spaces or tabs to separate option specifications on the command line. Option names and their keyword or file name arguments aren't case-sensitive, but identifiers used as arguments are case-sensitive. LIB processes options in the order specified on the command line and in command files. If an option is repeated with different arguments, the last one to be processed takes precedence.

The following options apply to all modes of LIB:

/ERRORREPORT [NONE | PROMPT | QUEUE | SEND]

The /ERRORREPORT option is deprecated. Starting in Windows Vista, error reporting is controlled by Windows Error Reporting (WER) settings.

/LINKREPRO:directory-path
/LINKREPROTARGET:filename

To help Microsoft diagnose lib.exe crashes and internal errors, you can use the /LINKREPRO option. This option generates a link repro, a set of build artifacts that allow Microsoft to reproduce a problem that occurs during library operations. The /LINKREPROTARGET option can be used with the /LINKREPRO option. It only generates link repro artifacts when lib.exe produces the specified file. For more information, see How to report a problem with the Microsoft C++ toolset.

/LTCG

"LTCG" stands for link-time code generation. This feature requires cooperation between the compiler (cl.exe), LIB, and the linker (LINK). Together they can optimize code beyond what any component can do by itself.

The /LTCG option to LIB specifies that the inputs from cl.exe include object files generated by using the /GL compiler option. If LIB encounters such inputs, and /LTCG isn't specified, it restarts with /LTCG enabled after displaying an informational message. In other words, it isn't necessary to set this option explicitly, but it speeds up build performance. That's because LIB doesn't have to restart itself.

In the build process, the output from LIB is sent to LINK. LINK has its own separate /LTCG option. It's used to perform various optimizations, including whole-program optimization and profile-guided optimization (PGO) instrumentation. For more information about the LINK option, see /LTCG.

/MACHINE

Specifies the target platform for the program. Usually, you don't need to specify /MACHINE. LIB infers the machine type from the .obj files. However, in some circumstances, LIB can't determine the machine type and issues an error message. If such an error occurs, specify /MACHINE. In /EXTRACT mode, this option is for verification only. Use lib /? at the command line to see available machine types.

/NOLOGO

Suppresses display of the LIB copyright message and version number and prevents echoing of command files.

/VERBOSE

Displays details about the progress of the session, including names of the .obj files being added. The information is sent to standard output and can be redirected to a file.

/WX[:NO]

Treat warnings as errors. For more information, see /WX (Treat Linker Warnings as Errors).

Other options apply only to specific modes of LIB. These options are discussed in the sections describing each mode.

See also

LIB Reference