Thursday, 14 February 2013


eBay Ads:
best selling and shopping at eBay 


Let's Take Example Of C Language..
It has 4 Stages.. 

1. Preprocessing:
(In gcc, it is the 'gcc -E' stage).Here, The Preprocessor replaces the #include files, include guards, #define (macros), etc with code.

2. Compiling:
(In gcc, It is the 'gcc -c' stage) Turns code (after preprocessor is done with it) from human understandable text to "machine code".
Basically, into assembly language (creates .o files for instance).
To be noted here is that the .o files so created still have textual symbols in them, not actual memory addresses. 

Compilation itself has many sub-stages ( http://www.programcreek.com/2011/02/how-compiler-works/  ): 



3. Linking:
(in gcc,It is gcc -o stage) Turns the files produced from Compilation stage (object files like .o, .so files, etc) into actual executables (a.out, or a.exe).

This is where two things happen:
     A. Relocation:
     The Executable needs to be "built" into a format that the OS will understand. Whatever the compiler
     hands off to the linker needs to be laid out into the executable's data segment (holds program data),
     text segment (holds program code), heap (holds dynamically allocated memory through malloc, calloc, etc),
     stack (holds program stacks - return addresses for functions called), etc. 



       B. Symbol resolution:
       The symbols generated from step 2, are actually resolved into addresses here. These are not actual
       physical addresses in memory; these are some "temp" addresses. Resolving them into actual addresses in
       memory is a job that is done by the operating system's memory manager. 


4. Runtime: The runtime loads the dynamically loaded dlls (dynamic link libraries) as needed for the executable so generated, resolves shared dependencies, etc.



MORE:
1. http://www.thegeekstuff.com/2011/10/c-program-to-an-executable/
 eBay Ad:
  Let's Take A Look at  Online Mega Store;
ebay    ebay  

om..om.uk.

0 comments:

Post a Comment