I have seen in driver libraries these three files. How are the three files related, what is the order in which the files are compiled and what is the content of each file? In addition to this I have also seen .a files are they same as .lib?
-
your code contains headers .h and source files (.c/.cpp). The headers are pieces of code that are copy/pasted each time you #include them in your source file. When the code is compiled, the compiler outputs the source files as object files (.o or .obj). A .lib file is simply an archive that contains all the object files. The DLL library is compiled code that has a bunch of exported functions that you can reuse in your code. An .exe is compiled code that calls the main() function on start-up. – J-Mik May 19 '13 at 18:40
1 Answers
.lib and .dll files are both containers of executables of a Windows library (.o or .obj files), with the former (.lib) containing stuff (functions, definitions, etc) that you have to link statically to the executable file of your project. The latter (.dll) is either already present in your system or you put it into your system, and it is dynamically linked to the executable file of your project.
For Unix/Linux systems, the file-extensions are .a and .so respectively (that is, .a instead of .lib, and .so instead of .dll).
In all cases, when compiling your project you must #include
one or more of the .h files provided to you by the library you are using (they are called header files), because that's where the stuff inside the executables of the library get defined.
EDIT
The main advantage of a statically linked library is that it is self-contained (no external dependencies) but it increases the size of your own executable file. The main disadvantage is that future versions must be re-compiled and re-distributed.
For dynamically linked libraries, we re-distribute just the updated library executables. The main disadvantage is that our program relies on the library being already installed on the customer's system.

- 560
- 3
- 7
-
It should be noted that there is also something which is called "Import Library" check http://stackoverflow.com/questions/3573475/how-does-the-import-library-work-details – Wakan Tanka Sep 08 '16 at 22:42