1/32
Vocabulary flashcards summarizing essential terms and commands from the lecture on static/dynamic linking, the C preprocessor, and Make.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Compiling
The build phase where source files (.c) are translated into object files (.o) by gcc.
Linking
The build phase that combines object files and libraries into a final executable, resolving all external symbols.
Object File (.o)
Machine-code output of the compiler containing unresolved symbol references, ready to be linked.
Static Library (.a)
An archive of object files whose needed code is copied into the executable at link time.
Dynamic Library (.so)
A shared object loaded and linked by the loader at run time; symbols are resolved while the process starts or executes.
ar
Unix tool used to create and maintain static libraries (archives), e.g., ar rcs libfoo.a a.o b.o.
ld
The system linker; can be invoked directly but is usually called through gcc to produce executables.
GCC option -c
Tells gcc to stop after compiling and emit an object file, skipping the link step.
GCC option -Wall
Enables all recommended warning messages during compilation.
GCC option -g
Generates debugging information for use with gdb or other debuggers.
GCC option -o
Specifies the name of the output file (object, library, or executable).
GCC option -l
Links the program against a library named lib
GCC option -shared
Instructs gcc to produce a shared (dynamic) library.
GCC option -I
Adds a directory to the list searched for header files included with angle brackets
Position-Independent Code (PIC)
Object code compiled with -fpic that uses relative addressing so it can be loaded at any memory address.
Loader
Part of the OS that loads the executable and any required shared libraries into memory and performs dynamic linking.
Static Linking – Pros
All code resolved at link time, avoids version conflicts, and allows link-time optimization.
Dynamic Linking – Pros
Smaller executables and ability to update shared code system-wide without recompiling programs.
C Preprocessor
Stage that handles # directives (#include, #define, etc.) before actual compilation.
Directive that copies the contents of another file into the source during preprocessing.
Creates a macro or constant that the preprocessor substitutes throughout the source code.
Removes a previously defined macro name.
Macro
Textual substitution created with #define, often used for constants or inline code fragments.
Conditional Compilation
Technique using #if, #ifdef, #ifndef, #else, #endif to compile or skip code blocks based on conditions.
make
Build automation utility that determines which parts of a program need recompiling and issues commands to do so.
Makefile
File describing build targets, their dependencies, variables, and rules for the make utility.
Target (Makefile)
A file or action make will build or execute; appears on the left side of a rule.
Prerequisite
File(s) that a target depends on; if any prerequisite is newer, the target is rebuilt.
Rule (Makefile)
Specification of a target, its prerequisites, and the shell commands (indented by a tab) to build it.
Built-in Variables $@, $^, $<
$@ = target name, $^ = all prerequisites, $< = first prerequisite; used inside command lines.
Suffix Rule
Legacy Make feature defining a default way to turn one file type into another based on file suffixes.
Pattern Rule
Make rule where % acts as a wildcard (e.g., %.o : %.c) to define how to build many similar targets.
clean (Make target)
Conventional phony target that deletes intermediate and output files (e.g., rm -f *.o program).