Static vs. Shared vs. Dynamic Loaded Library
What is a Static Library?
Ref: What is a Static Library
Program Library HOWTO
This paper first discusses static libraries, which are installed into a program executable before the program can be run.
It then discusses shared libraries, which are loaded at program start-up and shared between programs.
Finally, it discusses dynamically loaded (DL) libraries, which can be loaded and used at any time while a program is running.
DL libraries aren't really a different kind of library format (both static and shared libraries can be used as DL libraries); instead, the difference is in how DL libraries are used by programmers.
Ref: Program Library HOWTO
What is a Static Library?
- The contents of this library are usually machine code files that are not readable by humans.
- These machine code files are normally generated from code compilation or a similar process.
- A static library is more flexible than a dynamic library becuase its exact path is irrelevant to the executable that uses it:
- Static libraries are linked into an executable file and their content has been included in the final program.
- A dynamic library's content is loaded as the executable runs, so its locations relative to the execuable and in the operating system are important.
- The contents of static libraries are not linked together because they are not expected to run on their own.
- Creating a static library that does not link properly within itself is not inherently dangerous as long as the library is linked with any other external files that may be necessary.
- A library can depend on an external group of object files, or one library anc depend on another.
Ref: What is a Static Library
Program Library HOWTO
This paper first discusses static libraries, which are installed into a program executable before the program can be run.
It then discusses shared libraries, which are loaded at program start-up and shared between programs.
Finally, it discusses dynamically loaded (DL) libraries, which can be loaded and used at any time while a program is running.
DL libraries aren't really a different kind of library format (both static and shared libraries can be used as DL libraries); instead, the difference is in how DL libraries are used by programmers.
Ref: Program Library HOWTO
請先 登入 以發表留言。