Continuing from our previous example, The linker can now takes over, it searches for the actual object code implementation containing scanf and printf, (along with any other dependencies), and combines it with the original main.o code from the example above.
In combining the object files, the references are resolved so that scanf and printf implementation can be accessed by the main.o machine code in the same way that find_sum can be accessed from the original object code file. The result is a stand alone executable file which is essentially our program.
In summary, Linkers combine the generated object code from the translation process to other dependencies or references needed to execute the program, it converts reference placeholders to actual addresses, thus linking the main program to its dependencies to create fully functioning executable code.
© 2024 Vedesh Kungebeharry. All rights reserved.