-
Phases of Compilation-Based Execution
- 1. Edit
- 2. Preprocess
- 3. Compile
- 4. Link
- 5. Load
- 6. Execute
-
Who invented C?
Dennis M. Ritchie
-
History of C
- -evolved from BCPL and B
- -C Standard created 1989
- -2nd standard ratified in 1999 called C99
- -current C standard informally named C11
-
1. Edit
- - accomplished with an editor program (e.i. Eclipse and Microsoft Visual Studio have editors integrated)
- -typed in w/the editor, corrections can be made, and the program is stored on a secondary storage device such as a hard drive
- -file names should end with .c extension
-
2. Preprocess
- - executes automatically before the compiler's translations phase begins
- - obeys special commands called preprocessor directives, which indicate that certain manipulations are to be performed on the program before compilation
- -manipulations usually consist of including other files, performing various text replacements, defining various macros, ect.
- example:
- #inlcude <stdio.h>
- #define <identifier>
-
3. Compile
- - translates C source code into object (machine-language) code and stores it on the dick
- note: object code is incomplete and not yet executable- object code produced by the compiler typically contains "holes" due to missing parts
-
4. Link
- - holes in object code are resolved here
- -links the object code with the code for the missing functions to produce an executable image
- -multiple object files might be combined into one executable file
-
5. Load
- - program must be places in memory before it can be executed
- - loader takes the executable image from disk and transfers it to memory
- - additional components from shared libraries are also loaded
-
6. Execute
-Finally, under the control of its CPU, the program executes one instruction at a time
|
|