What is compiler, linker, loader?

后端 未结 14 954
离开以前
离开以前 2020-12-07 06:48

I wanted to know in depth meaning and working of compiler, linker and loader. With reference to any language preferably c++.

相关标签:
14条回答
  • 2020-12-07 07:25

    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.

    0 讨论(0)
  • 2020-12-07 07:28

    *

    explained with respect to, linux/unix based systems, though it's a basic concept for all other computing systems.

    *

    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

    0 讨论(0)
提交回复
热议问题