Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between .lib and .a files?

I'm trying to statically compile something and I'm trying to get a handle on what all these dependencies are. I know that .dll files are for dynamically linked dependencies that will be required by the final output, but what are .a and .lib files and when do you need each of those?

like image 521
Nantucket Avatar asked Feb 25 '10 21:02

Nantucket


People also ask

What is a .LIB file?

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.

What are .a files?

a is a static library (archive), while . so is a shared library (shared object).

What is the difference between .so and .a file?

A . a file is a static library, while a . so file is a shared object dynamic library similar to a DLL on Windows.

What are .a files in Linux?

In general, libraries are collections of data and functions written to be reused by other programmers or programs. On Linux, archive libraries end with the . a extension, and shared object libraries end with the . so extension.


1 Answers

.a is an archive of code: compiled but not linked. You would link statically with it during your program's final link step.

.lib can be either the same as .a, or a magical so-called "import library": a thin placeholder which causes you to require a .dll at runtime.

like image 193
crazyscot Avatar answered Sep 21 '22 13:09

crazyscot