answersLogoWhite

0

Compilation is a three-phase process: preprocessing, compilation and linking.

The preprocessor's job is to prepare a source file (translation unit) for compilation. This is achieved by reading each source file, stripping out the user-comments, performing macro substitutions and acting upon any conditional compilation directives, writing the output to an intermediate file which contains only C code and nothing else. Thus there will be one intermediate file generated for each translation unit.

The compiler's job is to create an object source file from an intermediate file. Object source files primarily consist of a machine code translation of the C source code followed by the symbol tables, which lists all the internal and external linkages of the translation unit. An external linkage is simply a type declaration which is not defined within the current translation unit; the definition may be provided by a type library or it may be provided by another translation unit. Either way, the compiler cannot generate the required machine code, so it uses a symbol (a placeholder) instead.

Once all translation units are compiled to object files, the linker examines the linkage tables and uses that information to generate a single machine code executable from the object source, substituting the placeholders generated by the compiler and adjusting memory offsets to suit the resultant code.

User Avatar

Wiki User

9y ago

Still curious? Ask our experts.

Chat with our AI personalities

FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: Why is the importance of link section in programming c?
Write your answer...
Submit
Still have questions?
magnify glass
imp