Libraries: 5 Header Files

Up: GEOS SDK TechDocs | Up | Prev: 4 Exported Routines and Classes | Next: 6 Compiler Directives

Every library should have at least one header file. This file contains declarations and definitions which are needed by each of the geodes which uses the library.

If a library exports routines but does not export object classes, its header will be a standard C header file. This file should contain declarations of every exported routine. It should also contain the definitions of any macros, constants, structures, etc., which clients might use.

If a library exports object classes, its header will be a Goc header with the suffix .goh . In addition to routine declarations, it must contain the complete declarations of each of the exported object classes, including all the message declarations. A .goh file should begin with the Goc directive " @deflib < libname>", and end with the directive " @endlib ". This ensures that the header will only be included once, even if the code tries to include it several times.

Large libraries may have several header files. For example, a library might declare several similar object classes. It is usually simpler to write a separate header for each class; a client can then include only the headers for classes which it will use. Note that the header for a class should use a Goc @include directive to include the header for that class's superclass.

It is of the utmost importance that the headers be kept in synchronization with the libraries they describe. As a rule, a library will include each one of those headers; that helps to keep all the files compatible. Nevertheless, you must be careful whenever changing a library.


Up: GEOS SDK TechDocs | Up | Prev: 4 Exported Routines and Classes | Next: 6 Compiler Directives