Before actually drawing the difference between dynamic loading and dynamic linking, it's imperative to understand the loading and linking in the operating system first.
These essential utility programs play a vital role in the program's execution.
The process of getting a program from secondary storage (hard disk) to the main memory (RAM) is known as loading. In simple words, loading loads the program in the main memory.
Linking all the required modules of the program to continue the program execution is known as linking. It intakes the object code through an assembler and combines them to make an executable module.
Let's have a look at the figure below to understand it better.
The linking and loading are further categorized into the two following types:
As our answer is about dynamic linking and loading, we'll discuss that. The dynamic linking or loading utilizes the memory very efficiently.
Before actual execution, all the programs are loaded into memory first. Sometimes the whole program is loaded into the memory, but sometimes a small part of the program or some routine is loaded into memory only. This mechanism of loading the program variably is known as dynamic loading.
Note: A dynamic load is any load of the program that changes over time or over the need. And it's done during the runtime or execution time.
Linking the object modules and dependent libraries during execution is known as dynamic linking. If the program call happens before execution time, it is postponed until execution.
Note: In dynamic linking, the code for some external routines is located and loaded when the program is first to run.
Dynamic loading | Dynamic linking |
The process of loading a system library or a system routine at runtime. | The process that links dependent libraries or routines at runtime. |
It is not supported by OS. | It is supported by OS. |
It refers to mapping an executable or library into a process's memory after it has started. | It refers to resolving symbols—associating their names with addresses or offsets—after compile time. |
Free Resources