Tuesday, July 8, 2008

Comiling Linking

Ok, So here I am with the most favorite topic of Computer programming industry.

What is the main difference in compiled code and that of executable code??

This is the question which even the experienced programmer don’t answer properly.

When asked you need to be little technical…

Ok when you compile the code a .o file is created. This is what we called compiled code (Rocket Science Funda Reveled ;) ) …

And what you get after linking all the required object files is called executable file.

SO whats the difference ?

When you compile the code some references may not be present in the same file which you are compiling. But compiler recognizes that ( as it sees the declaration in .h file you must have included in the file) from header file. Now this piece of code will not be available until run time, so normal jump instruction address can not be found at compile time. So Now what the compiler does is it leaves that jump filed empty and fills that at the run time… This is the main step which differentiate the object code and executable code. Jump instruction address are there in executable not in the object files…

Please note that that absolute address is even not know in the .exe file, it still does the guess work like 14 byes from beginning etc.

Main difference .o and .exe file is the jump address in the .o file is not known.

No comments: