TOC
Previous
Next
Standard program compilation and linking
Here's the traditional, simple way of building a program:
$ cc -c -g prog.c mod1.c mod2.c mod3.c
$ cc -o prog_nolib prog.o mod1.o mod2.o mod3.o
(Can equivalently use static library)
Disadvantages:
-
Disk space is wasted
wasted storing multiple copies of object modules.
-
Memory is wasted when several
different programs using the same modules
execute at the same time, because each program holds hold separate
copies of the object modules in virtual memory.
-
Programs must be relinked in order to see changes to object modules.
If a change is required (perhaps a bug fix) to an
object module, then all executables using that
module must be re-linked in order to incorporate the changes.
(C) 2006, Michael Kerrisk