next up previous contents index
Next: 3.1.2 Namespace Cleanliness Up: 3.1 Header File Conventions Previous: 3.1 Header File Conventions

3.1.1 Basic Structure

All of the OSKit's public header files are installed in an oskit subdirectory of the main installation directory for header files (e.g., /usr/local/include by default). Assuming client code is compiled with the main include directory in its path, this means that OSKit-specific header files are generally included with lines of the form `#include <oskit/foo.h>'. This is also the convention used by all of the internal OSKit components. Confining all the OSKit headers into a subdirectory in this way allows the client OS to place its own header files in the same header file namespace with complete freedom, without worrying about conflicting with OSKit header files.

The OSKit follows this rule even for header files with well-known, standardized names: for example, the ANSI/POSIX header files provided by the minimal C library (e.g., string.h, stdlib.h, etc.) are all located in a header file subdirectory called oskit/c. On the surface this may seem to make it more cumbersome for the client OS to use these headers and hence the minimal C library, since for example it would have to `#include <oskit/c/string.h>' instead of just the standard `#include <string.h>'. However, this problem can easily be solved simply by adding the oskit/c subdirectory to the C compiler's include path (e.g., add -I/usr/local/include/oskit/c to the GCC command line); in fact this is exactly what most of the OSKit components themselves do. Furthermore, strictly confining the OSKit headers to the oskit subdirectory, it makes it possible for the client OS and the OSKit itself to have several different sets of ``standard'' header files coexisting in the same directory structure: for example, the OSKit components derived from Linux or BSD typically leave oskit/c out of the compiler's include path and instead use the native OS's header files; this makes it much easier to incorporate legacy code with minimal changes.


next up previous contents index
Next: 3.1.2 Namespace Cleanliness Up: 3.1 Header File Conventions Previous: 3.1 Header File Conventions

University of Utah Flux Research Group