Next:  Dynamic Loading
Up:  Dynamic Linking and 
 Previous:  Dynamic Linking and 
 
 
When one uses a C compiler under a Unix system to generate an
executable from the C source code, the C compiler driver will
usually invoke a C preprocessor, compiler, assembler and link editor
in that order to translate the C language code into the executable
file.
-  The C compiler driver will first pass the C source code into
      a C preprocessor which outputs the pure C language code
      with the processed macros and directives,
 -  The C compiler translates the resultant C language code into
      machine-dependent assembly language code.
 -  The assembler translates the resultant assembly language
      code into the machine instructions of the target
      machine. The resultant machine instructions are stored in
      an object
      file in a specific binary format. In our case, the object
      files use the ELF binary format.
 -  In the last stage, the link editor links all the object files
      together with the start up codes and library functions which
      are referenced in the program. There are two kinds of
      libraries one can use:
-  A  static library is a collection of object files which
      contain library routines and data. It is
      built in such a way that the link editor will incorporate
      a copy of only those object files that hold the functions and
      data
      referenced in the program into the executable at
      link time.
 -  A  shared library is a shared object file that contains
      functions and data. It is built
      in such a way that the link editor will only store in the
      executable the name of the shared library and
      information about the symbols referenced by the
      executable. At run time the dynamic linker, a.k.a.
      the  program interpreter in ELF, will map the shared library
      into the virtual address space of the process image of the
      executable and resolve by name the symbols in the shared library
      used by the executable. That is process is
      also called  dynamic linking.
 
 
There is nothing special which needs to be done by the programmer
to take advantage of shared libraries with dynamic linking.
Everything is transparent to programmers as well as to
users.
 
   
   
         
 Next:  Dynamic Loading
Up:  Dynamic Linking and 
 Previous:  Dynamic Linking and 
 
 
 
J.H.M.Dassen 
Tue Aug  1 14:18:10 MDT 1995