Skip to content

Commit b1f3771

Browse files
author
Colin Robertson
committed
Acrolinx, clarity, versioning
1 parent 328d8c4 commit b1f3771

2 files changed

Lines changed: 34 additions & 31 deletions

File tree

docs/build/reference/overview-of-lib.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.assetid: e997d423-f574-434f-8b56-25585d137ee0
88
---
99
# Overview of LIB
1010

11-
LIB creates standard libraries, import libraries, and export files you can use with [LINK](linker-options.md) when building a program. LIB runs from a command prompt.
11+
LIB (lib.exe) creates standard libraries, import libraries, and export files you can use with [LINK](linker-options.md) when building a program. LIB runs from a command prompt.
1212

1313
You can use LIB in the following modes:
1414

@@ -20,31 +20,31 @@ You can use LIB in the following modes:
2020

2121
These modes are mutually exclusive; you can use LIB in only one mode at a time.
2222

23-
## Lib Options
23+
## LIB Options
2424

2525
The following table lists the options for lib.exe, with a link to more information.
2626

2727
|Option|Description|
2828
|-|-|
29-
|**/DEF**|Create an import library and an export file.<br/><br/>For more information see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
30-
|**/ERRORREPORT**| Send information to Microsoft about internal errors with lib.exe.<br/><br/>For more information see [Running LIB](running-lib.md).|
31-
|**/EXPORT**| Exports a function from your program.<br/><br/>For more information see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
32-
|**/EXTRACT**| Create an object (.obj) file that contains a copy of a member of an existing library.<br/><br/>For more information see [Extracting a Library Member](extracting-a-library-member.md).|
33-
|**/INCLUDE**| Adds a symbol to the symbol table.<br/><br/>For more information see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
34-
|**/LIBPATH**| Overrides the environment library path.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
29+
|**/DEF**|Create an import library and an export file.<br/><br/>For more information, see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
30+
|**/ERRORREPORT**| Send information to Microsoft about internal errors with lib.exe.<br/><br/>For more information, see [Running LIB](running-lib.md).|
31+
|**/EXPORT**| Exports a function from your program.<br/><br/>For more information, see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
32+
|**/EXTRACT**| Create an object (.obj) file that contains a copy of a member of an existing library.<br/><br/>For more information, see [Extracting a Library Member](extracting-a-library-member.md).|
33+
|**/INCLUDE**| Adds a symbol to the symbol table.<br/><br/>For more information, see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
34+
|**/LIBPATH**| Overrides the environment library path.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
3535
|**/LINKREPRO**| Creates artifacts needed to reproduce a lib.exe crash or internal error.<br/><br/>For more information, see [Running LIB](running-lib.md).|
3636
|**/LINKREPROTARGET**| Only generates the **/LINKREPRO** artifacts when lib.exe is used with a specified file.<br/><br/>For more information, see [Running LIB](running-lib.md).|
37-
|**/LIST**| Displays information about the output library to standard output.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
38-
|**/LTCG**| Causes the library to be built using link-time code generation.<br/><br/>For more information see [Running LIB](running-lib.md).|
39-
|**/MACHINE**| Specifies the target platform for the program.<br/><br/>For more information see [Running LIB](running-lib.md).|
40-
|**/NAME**| When building an import library, specifies the name of the DLL for which the import library is being built.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
41-
|**/NODEFAULTLIB**| Removes one or more default libraries from the list of libraries it searches when resolving external references.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
42-
|**/NOLOGO**| Suppresses display of the LIB copyright message and version number and prevents echoing of command files.<br/><br/>For more information see [Running LIB](running-lib.md).|
43-
|**/OUT**| Overrides the default output filename.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
44-
|**/REMOVE**| Omits an object from the output library.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
45-
|**/SUBSYSTEM**| Tells the operating system how to run a program created by linking to the output library.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
46-
|**/VERBOSE**| Displays details about the progress of the session, including names of the .obj files being added.<br/><br/>For more information see [Running LIB](running-lib.md).|
47-
|**/WX**| Treat warnings as errors.<br/><br/>For more information see [Running LIB](running-lib.md).|
37+
|**/LIST**| Displays information about the output library to standard output.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
38+
|**/LTCG**| Causes the library to be built using link-time code generation.<br/><br/>For more information, see [Running LIB](running-lib.md).|
39+
|**/MACHINE**| Specifies the target platform for the program.<br/><br/>For more information, see [Running LIB](running-lib.md).|
40+
|**/NAME**| When building an import library, specifies the name of the DLL for which the import library is being built.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
41+
|**/NODEFAULTLIB**| Removes one or more default libraries from the list of libraries it searches when resolving external references.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
42+
|**/NOLOGO**| Suppresses display of the LIB copyright message and version number and prevents echoing of command files.<br/><br/>For more information, see [Running LIB](running-lib.md).|
43+
|**/OUT**| Overrides the default output filename.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
44+
|**/REMOVE**| Omits an object from the output library.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
45+
|**/SUBSYSTEM**| Tells the operating system how to run a program created by linking to the output library.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
46+
|**/VERBOSE**| Displays details about the progress of the session, including names of the .obj files being added.<br/><br/>For more information, see [Running LIB](running-lib.md).|
47+
|**/WX**| Treat warnings as errors.<br/><br/>For more information, see [Running LIB](running-lib.md).|
4848

4949
## See also
5050

docs/build/reference/running-lib.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,21 @@ Various command-line options can be used to control LIB.
1414

1515
To run LIB, type the command `lib` followed by the options and file names for the task you are using LIB to perform. LIB also accepts command-line input in command files, which are described in the following section. LIB does not use an environment variable.
1616

17-
> [!NOTE]
18-
> If you are accustomed to the LINK32.exe and LIB32.exe tools provided with the Microsoft Win32 Software Development Kit for Windows NT, you may have been using either the command `link32 -lib` or the command `lib32` for managing libraries and creating import libraries. Be sure to change your makefiles and batch files to use the `lib` command instead.
19-
2017
## LIB Command Files
2118

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

24-
> **LIB \@**<em>commandfile</em>
21+
> **LIB \@**<em>command-file</em>
2522
26-
The file *commandfile* is a text file. No space or tab is allowed between the at sign (**\@**) and the file name. There is no default extension; you must specify the full file name, including any extension. Wildcards cannot be used. You can specify an absolute or relative path with the file name.
23+
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; you must specify the full file name, including any extension. Wildcards can't be used. You can specify an absolute or relative path with the file name.
2724

28-
In the command file, arguments can be separated by spaces or tabs, as they can on the command line; they 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.
25+
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.
2926

30-
You can specify either all or part of the command line in a command file, and you can use more than one command file in a LIB command. LIB accepts the command-file input as if it were specified in that location on the command line. Command files cannot be nested. LIB echoes the contents of command files unless the /NOLOGO option is used.
27+
You can specify either all or part of the command line in a command file, and you can 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.
3128

3229
## Using LIB Options
3330

34-
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 cannot 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 are not 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.
31+
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.
3532

3633
The following options apply to all modes of LIB:
3734

@@ -41,22 +38,28 @@ If lib.exe fails at runtime, you can use **/ERRORREPORT** to send information to
4138

4239
For more information about **/ERRORREPORT**, see [/errorReport (Report Internal Compiler Errors)](errorreport-report-internal-compiler-errors.md).
4340

41+
::: moniker range=">=vs-2019"
42+
4443
> **/LINKREPRO:**_directory-path_ \
4544
> **/LINKREPROTARGET:**_filename_
4645
4746
To help Microsoft diagnose lib.exe crashes and internal errors, you can use the **/LINKREPRO** option. It works the same way as the [/LINKREPRO](linkrepro.md) linker option. The [/LINKREPROTARGET](linkreprotarget.md) option can be used with the **/LINKREPRO** option. It filters on a _filename_, to only generate repro artifacts when lib.exe is used on that file. For more information, see [How to report a problem with the Microsoft C++ toolset](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md).
4847

48+
The **/LINKREPRO** and **/LINKREPROTARGET** options are available starting in Visual Studio 2019 version 16.1.
49+
50+
::: moniker-end
51+
4952
> **/LTCG**
5053
5154
"LTCG" stands for *link-time code generation*. This feature requires cooperation between the compiler ([cl.exe](compiler-options.md)), LIB, and the linker ([LINK](linker-options.md)) in order to optimize code beyond what any component can do by itself.
5255

53-
For LIB, the **/LTCG** option specifies that the inputs from cl.exe include object files that were generated by using the [/GL](gl-whole-program-optimization.md) compiler option. If LIB encounters such inputs and **/LTCG** is not specified, it will restart with /LTCG enabled after displaying an informational message. In other words, it is not necessary to explicitly set this option, but it speeds up build performance to do so because LIB does not have to restart itself.
56+
For LIB, the **/LTCG** option specifies that the inputs from cl.exe include object files that were generated by using the [/GL](gl-whole-program-optimization.md) compiler option. If LIB encounters such inputs and **/LTCG** isn't specified, it will restart with /LTCG enabled after displaying an informational message. In other words, it isn't necessary to explicitly set this option, but it speeds up build performance to do so because LIB doesn't have to restart itself.
5457

55-
In the build process, the output from LIB is sent to LINK. LINK has its own separate **/LTCG** option which is used to perform various optimizations, including whole-program optimization and profile-guided optimization (PGO) instrumentation. For more information about the LINK option, see [/LTCG](ltcg-link-time-code-generation.md).
58+
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](ltcg-link-time-code-generation.md).
5659

5760
> **/MACHINE**
5861
59-
Specifies the target platform for the program. Usually, you do not need to specify /MACHINE. LIB infers the machine type from the .obj files. However, in some circumstances, LIB cannot 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.
62+
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.
6063

6164
> **/NOLOGO**
6265
@@ -68,7 +71,7 @@ Displays details about the progress of the session, including names of the .obj
6871

6972
> **/WX**[**:NO**]
7073
71-
Treat warnings as errors. See [/WX (Treat Linker Warnings as Errors)](wx-treat-linker-warnings-as-errors.md) for more information.
74+
Treat warnings as errors. For more information, see [/WX (Treat Linker Warnings as Errors)](wx-treat-linker-warnings-as-errors.md).
7275

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

0 commit comments

Comments
 (0)