
The shared library needed in the linking is stored in virtual memory to save RAM. Instead of linking same object again and again into the library, each module share information of a object with other module having same object. it means we are using a same object a number of times in the program. It require less memory space as multiple program can share a single copy of the library. There is more chances of error and failure chances. This linking is accomplished by placing the name of a shareable library in the executable image. Dynamic linking – Dynamic linking is performed during the run time. No failure chance and less error chance.Ģ. As it does not require the presence of library on the system when it is run. As a result, it require more memory space. The linker copy all library routines used in the program into executable image.
#COMPILER DESIGN IN C SOURCE CODE CODE#
Relocation – It relocate code and data section and modify symbol references to the relocated memory location.Symbol resolution – It associates each symbol reference with exactly one symbol definition.It takes collection of relocatable object file and command-line argument and generate fully linked object file that can be loaded and run. Linking is performed before execution in static linking. It is performed during the compilation of source program. Source code -> compiler -> Assembler -> Object code -> Linker -> Executable file -> Loader Linking is performed at the last step in compiling a program. Linking is performed at both compile time, when the source code is translated into machine code and load time, when the program is loaded into memory by the loader. It takes object modules from assembler as input and forms an executable file as output for loader. Linker also link a particular module into system library. Linking is process of collecting and maintaining piece of code and data into a single file. Linker is a program in a system which helps to link a object modules of program into a single object file. Prerequisite – Introduction of Compiler design
