CMPSC 311 Test 2 Build Processing Flashcards
semantics, machines
Why do we build programs: to turn program —– from human-readable text into something —- understand
compilers, interpretors
why use language —- instead of ——-? It depends
compiling, linking, gcc, Id
there are two phases of building a program, — and —–
—– is used to build the program
—- can be used to link the program (or gcc)
gcc [options]
You will run a command to compile: ——————-
-c
—– tells the compiler to just generate object files
-Wall
—- tells the compiler to show all warnings
-g
—– tells the compiler to generate debug information
-o
— —— write output to a file
gcc hello.c -c -Wall -g -o hello.c
compiling hello.c syntax
gcc [options]
command to link sytnax: ——-
-l
—– link with a library
-g
tells the compiler to generate debug information
-o
write output to files
gcc hello.o goodbye.o -g -lmyexample -o hello
linking program syntax
library
A —— is a collection of related code and functions that are linked against a C program
exports, symbols
the library —- ——-
unresolved symbols
Your program object code has ——– ——
linker, program
the —- pulls chunks of the library. containing those symbols and places them into the ———
resolved
the program is done linking when all the pieces are —–
static
It is called —— linking because this is done at link time
statically linked, archive, linker, code
A —– —– library produces object code that is inserted into program at link time.
You are building an —- of the library which the —- uses to search for and transfer —- into your program
ar rcs lib .a
static library syntax
lib???.a
library naming: with very few exceptions all static libraries are named ———
name, file
You link against the —– of the library, not against the name of the —- in which the library exists
R
—- replace existing code with the objects passed
C
—- create the library if needed
S
—– create an index for relocatable code
dynamic library
A —– —- is a collection of related code and functions that are —- at runtime
exports, symbols
The library —– —–
unresolved symbols
Your program object code has —– ——