I wanted to know in depth meaning and working of compiler, linker and loader. With reference to any language preferably c++.
相关问题
- How do shader compilers work?
- C++ Builder - Difference between Lib and Res
- Direct2D Only Partially Linking in C++ Builder
- What are the recommended GNU linker options to spe
- What is the right order of linker flags in gcc?
相关文章
- MPI and D: Linker Options
- How to force Delphi compiler to display all hints
- Xcode - How to change application/project name : w
- Weakly link static library via -weak_library
- What other neat tricks does the SpecialNameAttribu
- What is the purpose of “-Wa,option” in GCC? [close
- Why does the C++ compiler give errors after lines
- Can a compiler inline a virtual function if I use
Operating System: An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs. The operating system is a component of the system software in a computer system. Application programs usually require an operating system to function.
Compiler: A compiler is a computer program (or a set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language), with the latter often having a binary form known as object code.
Interpreter: interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without previously compiling them into a machine language program.
Assembler: An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations.
Loader: a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution.
Linker: linker is a program that combines object modules to form an executable program.
Preproccesor: Preproccesor is a text substitution tool and it instructs the compiler to do required pre-processing before the actual compilation.
Wikipedia ought to have a good answer, here's my thoughts:
Hope this helps you a little more.
First, go through this diagram:
You make a piece of code and save the file (Source code), then
Preprocessing :- As the name suggests, it's not part of compilation. They instruct the compiler to do required pre-processing before the actual compilation. You can call this phase Text Substitution or interpreting special preprocessor directives denoted by #.
Compilation :- Compilation is a process in which a program written in one language get translated into another targeted language. If there is some errors, the compiler will detect them and report it.
Assemble :- Assemble code gets translated into machine code. You can call assembler a special type of complier.
Linking:- If these piece of code needs some other source file to be linked, linker link them to make it a executable file.
There are many process that happens after it. Yes, you guessed it right here comes the role of the loader:
Loader:- It loads the executable code into memory; program and data stack are created, register gets initialized.
Little Extra info :- http://www.geeksforgeeks.org/memory-layout-of-c-program/ , you can see the memory layout over there.
Compiler :it is a system software which correct the error of programs,object file ,messages etc
Linker:it is a system software which combines One or more objectfiles and possible some library code into either some exicutable some library or a list of error
Loader: A program which loads the executable file to the primary memory of the machine
Compiler: It is a program which translates a high level language program into a machine language program. A compiler is more intelligent than an assembler. It checks all kinds of limits, ranges, errors etc. But its program run time is more and occupies a larger part of the memory. It has slow speed. Because a compiler goes through the entire program and then translates the entire program into machine codes. If a compiler runs on a computer and produces the machine codes for the same computer then it is known as a self compiler or resident compiler. On the other hand, if a compiler runs on a computer and produces the machine codes for other computer then it is known as a cross compiler.
Linker: In high level languages, some built in header files or libraries are stored. These libraries are predefined and these contain basic functions which are essential for executing the program. These functions are linked to the libraries by a program called Linker. If linker does not find a library of a function then it informs to compiler and then compiler generates an error. The compiler automatically invokes the linker as the last step in compiling a program. Not built in libraries, it also links the user defined functions to the user defined libraries. Usually a longer program is divided into smaller subprograms called modules. And these modules must be combined to execute the program. The process of combining the modules is done by the linker.
Loader: Loader is a program that loads machine codes of a program into the system memory. In Computing, a loader is the part of an Operating System that is responsible for loading programs. It is one of the essential stages in the process of starting a program. Because it places programs into memory and prepares them for execution. Loading a program involves reading the contents of executable file into memory. Once loading is complete, the operating system starts the program by passing control to the loaded program code. All operating systems that support program loading have loaders. In many operating systems the loader is permanently resident in memory.