-
After compilation your C program is put into a number
of .o files, so all of these files must be combined into one
file that is the executable version of the program. When
the files are combined references between the files must
be satisfied
That is, when a procedure in file1.c calls a procedure in
file2.c, the first procedure will eventually need to know
that address of the second procedure. When file1.c is
compiled this address is unknown so it is left as an
external reference
When the program is loaded, ld finds all the external
references, determines where the routines and variables
are actually located in memory and then goes back and
fills in these addresses
Loading also includes library files - your program can
reference procedures that are in a library, when the
program is loaded the procedures in the library must also
be loaded, and thus the external references are satisfied
The -l (ell) flag is used to specify the libraries that are
to be loaded with a program, the standard C library is
automatically loaded with your program
|
 |