Difference Between Linker vs. Loader

Advertisement

Main Difference

The difference between linker and loader is that linker generates an executable module of a source program whereas loader loads the executable module to the main memory.

Advertisement

Linker vs. Loader

There are utility programs that play the main role in the execution of any program; there are two types of utility programs that are linker and loader. Any source code of a program has to pass through compiler, assembler, linker, loader and this is the order of the execution of any program. Linker intakes the object codes generated by the assembler and combines them to generate the executable module. Loader, on the other hand, loads the executable module to the main memory for the execution. The program that has to be executed is present in main memory. Loader, load the executable file in the operating system. Loader allocates the memory space to the executable module in the main memory. There are three types of the loader that are: absolute loader, relocatable loader and dynamic run time loading. These three loaders have different loading approaches that are absolute loading approach, relocatable loading approach and dynamic run time loading approach

Advertisement

Assembler and compiler are not same process but they do same work that is they generates the object code of a source program and hands it to linker. The main process of linker is to take the object code and generate the executable code for the program after this work of linker is finished and it assign the code to loader. There are some built in libraries and header files in high level language. There are some library functions which are defined in built in libraries. The absolute loader loads the executable file of the program into the same main memory location. In absolute loader, the programmer must be aware of the assignment. Relocating loader compile or assemble actual main memory address. Dynamic run time loader, absolute memory program is generated when an instruction is executed. Functions are linked to a library function by the linker. The compiler is being informed in the case if library function is not found of the particular function. When there is a large program, then it is divided into smaller programs that are known as modules. Object modules are generated when these modules are compiled or assembled. Linker have to combine the whole program together. There are two types of linker one is linkage editor that generates relocated, executable module and other is a dynamic linker that linkage the external modules until the load module is generated.

Advertisement

Comparison Chart

BasisLinkerLoader
MeaningLinker generate executable module of a source programThe loader loads the executable module to the main memory.
InputLinker take input an object code by assemblerLoader takes executable module has input
FunctionLinker combines all the object modulesLoader allocates the address to an executable file
TypeTypes of the linker are linkage editor and dynamic editorTypes of loader are absolute loader, dynamic run time loader and relocating loader.

What is Linker?

Assembler and compiler are not the same processes, but they do same work that is they generate the object code of a source program and hands it to the linker. The main process of the linker is to take the object code and generate the executable code for the program after this work of linker is finished, and it assigns the code to the loader. There are some built in libraries and header files in high level language. There are some library functions which are defined in built in libraries. These functions are linked to a library function by the linker. The compiler is being informed in the case if library function is not found of the particular function. When there is a large program, then it is divided into smaller programs that are known as modules. Object modules are generated when these modules are compiled or assembled. Linker have to combine the whole program together. There are two types of linker one is linkage editor that generates relocated, executable module and other is a dynamic linker that linkage the external modules until the load module is generated.

What is Loader?

The program that has to be executed is present in main memory. Loader, load the executable file in the operating system. Loader allocates the memory space to the executable module in the main memory. There are three types of loader that are: absolute loader, relocatable loader and dynamic run time loading. These three loader have different loading approaches that are absolute loading approach, relocatable loading approach and dynamic run time loading approach. Absolute loader loads the executable file of the program into the same main memory location. In absolute loader, programmer must be aware of the assignment. Relocating loader compile or assemble actual main memory address. Dynamic run time loader, absolute memory program is generated when an instruction is executed.

Key Differences

  1. Linker generate executable module of a source program whereas loader loads the executable module to the main memory.
  2. Linker take input an object code by assembler whereas Loader takes executable module has to input
  3. Linker combines all the object modules whereas Loader allocates the address to an executable file.
  4. Types of the linker are linkage editor and dynamic editor whereas Types of loader are absolute loader, dynamic run time loader and relocating loader.

Comparison Video