When we compile a program, the code for the various in-built functions are copied from the appropriate libraries. This process of linking of library functions during compilation is called Static Linking.

The process of linking of library functions during runtime is called Dynamic Linking. In Dynamic Linking, the code for the functions are not copied during compilation, rather only a reference to them is added. At runtime, the reference is resolved (when needed) and the code inside the library where the function definition exists is given the control. After completion the control is passed to the application.

Note:- Control here implies the flow of execution.

Dynamic Linking has various advantages when compared to static linking:-

  • Smaller Size of Compiled Application: The function definitions
  • Easy Updation: The program does not need recompilation if the library is updated.
  • Better Memory Usage: A Library can be shared by multiple programs, thus the memory requirement is reduced.

A compiled library file has an extension .dll which stands for Dynamic Link Library.

No votes yet.
Please wait...