I need little clarification in this area. I feel that the terms Static library
& Dynamic Library
are not correct.
- lib1.o + lib2.o + lib3.o --> "LinkerOutputFile"(executable or library).
If this "LinkerOutputFile" contains the code of all the files lib1.o , lib2.o, lib3.o then its said that "LinkerOutputFile" is satically-linked "LinkerOutputFile"(executable or library). (or)
If "LinkerOutputFile" just contains references & other information about to lib1.o, lib2.o, lib3.o without containing the code of these lib*.o files. Then its said that "LinkerOutputFile" Dynamically linked.
How does this make lib*.o files either a static library or dynamic library? They are just library files.
Or is it that, "LinkerOutputFile" is a library instead of executable then depending on whether its statically-linked or dynamically-linked its called static-library or dynamic-library. True or False?
I know I'm wrong, because, I know that
On most unix-style platforms the extensions are
- .a for static libraries (archives) and
- .so for shared libraries.
On Windows:
- .dll indicates a shared library
- .lib indicates a static or import library.
But can't figure out where I'm wrong. Also please tell me how are Static library
& Dynamic Library
internally different.
Also, this is from ABI specification:
This chapter describes the object file format, called ELF (Executable and Linking Format). There are three main types of object files.
A relocatable file holds code and data suitable for linking with other object files to create an executable or a shared object file.
An executable file holds a program suitable for execution; the file specifies how exec(BA_OS) creates a program's process image.
A shared object file holds code and data suitable for linking in two contexts. First, the link editor [see ld(BA_OS)] processes the shared object file with other relocatable and shared object files to create another object file. Second, the dynamic linker combines it with an executable file and other shared objects to create a process image.
"shared object file" are other words for saying Dynamic Library(has *.so extension). But what about "Static library"? This doesn't even mention it.
Is there any difference between, "Relocatable" & "Static Library" & "Import Library"? Please clarify me with internal structure.