This chapter discusses the linking phase of building Unix-based software under Mac OS X. In particular, header files and libraries are covered.
There are two types of header files in Mac OS X:
These header files are inserted into source code by a preprocessor prior to compilation. Ordinary header files have a .h extension.
These header files have a .p extension.
Header files serve four functions:
They contain C declarations.
They contain macro definitions.
They provide for conditional compilation.
They provide line control when combining multiple source files into a single file that is subsequently compiled.
The mechanism for
compliance is built into
the system header files. The preprocessor variables
_ _STRICT_ANSI_ _, and
_POSIX_SOURCE are supported. Because Mac OS X
itself is not POSIX.4 compliant, you cannot
achieve strict POSIX.4 compliance. Using these
mechanisms, however, is the best way to approximate
Unix developers will find the ordinary header files familiar, since they follow the BSD convention. The C preprocessor directive #include includes a header file in a C source file. There are essentially three forms of this syntax:
This form is used if the header file is located in the directory /usr/include.
This form is used if the header file is located in the ...