lib (file extension)

from Wikipedia, the free encyclopedia

The file name extension .lib can stand for two different types of files on Windows systems. On the one hand for a static library , on the other hand for the import library of a dynamic library . Both file types are used in application development to provide certain functionality to different programs. Both types are stored in the PE / COFF . .lib files are only used in the development of programs that are translated directly into machine code. For .NETThere are no longer any static libraries or import libraries for programs. Instead, all required information is summarized in a DLL file.

.Lib as a static library

A .lib -File as a static library contains both all the information necessary to the program to the left , and the instructions themselves. The .lib file there is usually provided by the program LIB.EXE (the Library Manager of Visual Studio ) generated. If another program wants to use the functionality of the library, the linker for you have compile time the .lib transferred file. This finds the required functions and integrates them firmly into the program to be created. The .lib file is no longer used to run the program .

Import Library

An import library of a dynamic library contains information to link a program against a dynamic library. The .lib file is usually generated by the program LINKER.EXE (the linker of Visual Studio) during the compilation of a dynamic library (a DLL) and must be passed on together with it. It contains information about which functionalities can be found in the DLL and how these can be used by other programs. In order for another program to be able to use these functionalities, the linker must be given the import library at compilation time so that it can find and reference the functions. In contrast to a static library, there are no instructions in the import library. These are read directly from the DLL while the program is running. The .lib file is no longer used to run the program .

In addition to this process (known as implicit linking ), a DLL can also be linked explicitly . The DLL and the function to be called are explicitly specified in the program code . No import library is required for this.

Individual evidence

  1. .Lib Files as Linker Input Microsoft Developer Network, Retrieved March 7, 2014.
  2. What is a DLL? Microsoft Knowledge Base, accessed March 7, 2014.
  3. http://msdn.microsoft.com/en-us/library/d14wsce5.aspx Linking Implicitly Microsoft Developer Network, Retrieved March 7, 2014.
  4. Linking Explicitly Microsoft Developer Network, Retrieved March 7, 2014.