C compilation system

C compilation system

This chapter describes the UNIX operating system tools used to generate an executable program from C language source files.

The first section, ``Compiling and linking'' details the command line syntax used to produce a binary representation of a program -- an executable file. It concentrates on the options to the cc(CP) command that control the process in which object files are created from source files, then linked with each other and with the library functions that are called in your program. The major focus of the section is on static vs. dynamic linking: how each model is implemented and invoked, and its relative merits.

Standard libraries are the focus of the second section of the chapter, ``Libraries and header files''. Because the C language contains no intrinsic input/output facility, I/O must be carried out by explicitly called functions. The UNIX operating system, the functions that perform these and other high-level tasks have been standardized and grouped in libraries. They are convenient, portable, and optimized for your machine. The contents of some important standard libraries are described later in this chapter.

Header files contain definitions and declarations that serve as the interface between your program and the functions in these libraries. They also contain several functions, such as getc() and putc(), that actually are defined as macros. The manual page will generally tell you whether what you are using is a macro or a function. Macros and functions are both used in the same way in your program. The descriptions of standard libraries in this chapter show the header files that you need to include in your program if you call a function in those libraries. The manual page for each function also lists the required header files. ``How to use library functions'' shows how to use library functions in your program and how to include header files.

Next topic: Compiling and linking

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003