I wanted to know in depth meaning and working of compiler, linker and loader. With reference to any language preferably c++.
A Compiler translates lines of code from the programming language into machine language.
A Linker creates a link between two programs.
A Loader loads the program into memory in the main database, program, etc.
*
*
Linkers and Loaders from LinuxJournal explains this concept with clarity. It also explains how the classic name a.out came. (assembler output)
A quick summary,
c program --> [compiler] --> objectFile --> [linker] --> executable file (say, a.out)
we got the executable, now give this file to your friend or to your customer who is in need of this software :)
when they run this software, say by typing it in command line ./a.out
execute in command line ./a.out --> [Loader] --> [execve] --> program is loaded in memory
Once the program is loaded into the memory, control is transferred to this program by making the PC (program counter) pointing to the first instruction of a.out