I know .OBJ is the result of compiling a unit of compilation and .LIB is a static library that can be created from several .OBJ, but this difference seems to be only in the number of units of compilation. Is there any other difference? Is it the same or different file format?
I have come to this question when wondering if the same static variable defined in two (or more) .LIBs is merged or not during linking into the final executable. For .OBJs the variables are merged. But is it the same in .LIBs?
The Microsoft Library Manager (LIB.exe) creates and manages a library of Common Object File Format (COFF) object files. LIB can also be used to create export files and import libraries to reference exported definitions. You can start this tool only from the Visual Studio command prompt.
Object files contain relocatable machine code that is generated from your source code. Visual Studio creates one .
A LIB file contains a library of information used by a specific program. It may store a variety of information, which may include functions and constants referenced by a program or actual objects, such as text clippings, images, or other media.
A .LIB file is a collection of .OBJ files concatenated together with an index. There should be no difference in how the linker treats either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With