Advantages:
SpeedAll the code to execute the file is in one executable file, with little to virtually zero compatibility issuesDisadvantages:
Constant load time every time a file is compiled and recompiledLarger in size because the file has to be recompiled every time when adding new code to the executableAdvantages:
Only one copy of the shared library is kept in memory, making it much faster to compile programs and significantly reducing the size of the executable programDynamic linking load time will be reduced if the shared library code is already present in memoryDisadvantages:
Slower execution time compared to static librariesPotential compatibility issues if a library is changed without recompiling the library into memory
Shared libraries are libraries that use dynamic linking vs static linking in the compilation steps for compiling a file. Static and dynamic linking are two processes of collecting and combining multiple object files in order to create a single executable file. The main difference between the two is the type of linking they do when creating an executable file.
Dynamic linking defers much of the linking process until a program starts running. Compared to static libraries where a file in compiled and all the machine code is put into an executable file at compile time, dynamic linking performs the linking process “on the fly” as programs are executed in the system. In dynamic linking, dynamic libraries are loaded into memory by programs when they start. When you compile a shared library, the machine code is then stored on your machine, so when you recompile the program that has newly added code to it, the compilation process just adds the new code and store it to memory vs. recompiling an entire file into an executable file like a static library.