Static & Dynamic Linking, C Preprocessor, and Make – Key Vocabulary

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/32

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards summarizing essential terms and commands from the lecture on static/dynamic linking, the C preprocessor, and Make.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

33 Terms

1
New cards

Compiling

The build phase where source files (.c) are translated into object files (.o) by gcc.

2
New cards

Linking

The build phase that combines object files and libraries into a final executable, resolving all external symbols.

3
New cards

Object File (.o)

Machine-code output of the compiler containing unresolved symbol references, ready to be linked.

4
New cards

Static Library (.a)

An archive of object files whose needed code is copied into the executable at link time.

5
New cards

Dynamic Library (.so)

A shared object loaded and linked by the loader at run time; symbols are resolved while the process starts or executes.

6
New cards

ar

Unix tool used to create and maintain static libraries (archives), e.g., ar rcs libfoo.a a.o b.o.

7
New cards

ld

The system linker; can be invoked directly but is usually called through gcc to produce executables.

8
New cards

GCC option -c

Tells gcc to stop after compiling and emit an object file, skipping the link step.

9
New cards

GCC option -Wall

Enables all recommended warning messages during compilation.

10
New cards

GCC option -g

Generates debugging information for use with gdb or other debuggers.

11
New cards

GCC option -o

Specifies the name of the output file (object, library, or executable).

12
New cards

GCC option -l

Links the program against a library named lib.a or lib.so.

13
New cards

GCC option -shared

Instructs gcc to produce a shared (dynamic) library.

14
New cards

GCC option -I

Adds a directory to the list searched for header files included with angle brackets

15
New cards

Position-Independent Code (PIC)

Object code compiled with -fpic that uses relative addressing so it can be loaded at any memory address.

16
New cards

Loader

Part of the OS that loads the executable and any required shared libraries into memory and performs dynamic linking.

17
New cards

Static Linking – Pros

All code resolved at link time, avoids version conflicts, and allows link-time optimization.

18
New cards

Dynamic Linking – Pros

Smaller executables and ability to update shared code system-wide without recompiling programs.

19
New cards

C Preprocessor

Stage that handles # directives (#include, #define, etc.) before actual compilation.

20
New cards

include

Directive that copies the contents of another file into the source during preprocessing.

21
New cards

define

Creates a macro or constant that the preprocessor substitutes throughout the source code.

22
New cards

undef

Removes a previously defined macro name.

23
New cards

Macro

Textual substitution created with #define, often used for constants or inline code fragments.

24
New cards

Conditional Compilation

Technique using #if, #ifdef, #ifndef, #else, #endif to compile or skip code blocks based on conditions.

25
New cards

make

Build automation utility that determines which parts of a program need recompiling and issues commands to do so.

26
New cards

Makefile

File describing build targets, their dependencies, variables, and rules for the make utility.

27
New cards

Target (Makefile)

A file or action make will build or execute; appears on the left side of a rule.

28
New cards

Prerequisite

File(s) that a target depends on; if any prerequisite is newer, the target is rebuilt.

29
New cards

Rule (Makefile)

Specification of a target, its prerequisites, and the shell commands (indented by a tab) to build it.

30
New cards

Built-in Variables $@, $^, $<

$@ = target name, $^ = all prerequisites, $< = first prerequisite; used inside command lines.

31
New cards

Suffix Rule

Legacy Make feature defining a default way to turn one file type into another based on file suffixes.

32
New cards

Pattern Rule

Make rule where % acts as a wildcard (e.g., %.o : %.c) to define how to build many similar targets.

33
New cards

clean (Make target)

Conventional phony target that deletes intermediate and output files (e.g., rm -f *.o program).