What is a Module anyway?
Document: The safe-c User Guide
Using safe-c
The safe-c User Guide
Introduction
A C module normally consists of three separate files:
- A header file, normally having the extension .h .
This provides a specification of the external
interface to the module. That is, it specifies exactly how
other modules can invoke or use the facilities of this module.
- A source file, normally having the extension .c
. This is the actual C source code, or definition, of the module.
It specifies the internal implementation of the module.
- An object file, normally having the extension
.o . This is the file produced by using the C compiler
to translate the C source code in the source file into the
specific, binary, instruction codes (so-called "machine code")
which can be directly
processed by the CPU in the computer on which programs will be
executed.
A user of a module, who wishes to use its facilities in her
programs, needs access to the header file and the object file.
The header file is necessary so that, while the compiler
is translating
your source code, it can check that it is interfacing in a
correct and valid manner with the external module. The object
file is necessary so that a complete executable file can be
created by combining or linking together the object code from
your source file, with the object code of the external
module.
The user of a module does not require access to the
source code of that module. The source code is only required if
someone wants to modify the module in some way - correct
some defect, or add new facilities etc.
Document: The safe-c User Guide
Using safe-c
The safe-c User Guide
Introduction
McMullin@eeng.dcu.ie
Fri Jan 12 12:30:02 GMT 1996