Skip to content

Header scheme

Dana Robinson edited this page Sep 4, 2023 · 5 revisions

/hdf/src

There is currently a poor separation of public and private headers. hdf.h is the main library header file and including it brings in a number of other HDF4 header files, some of which are (theoretically) not supposed to be public. CMake deploys every header file in the repository. The Autotools deploy most of them.

hcompi.h includes the compression file headers, which start with 'c' (e.g., cszip.h). This file is only included from C files and is thus private.

OLD (4.2 and earlier)

The current scheme is as follows:

  • The "main" header for a component foo is named foo.h, regardless of whether it's private or public.
  • An "internal API" header intended for use by other parts of the HDF4 library is named "fooi.h" (i = internal). In practice, these are generally deployed as if they were public.
  • Symbols private to a component are protected by an ifdef like FOO_MASTER or _FOO_MAIN_ in the main header.
  • Most of the public API calls are declared in hproto.h

NEW (4.3 and later)

Starting in HDF4 4.3.0, we are making an effort to better differentiate between public and private symbols.

  • The public header of a component foo is named foo.h. Private components will not have a public header file.
  • An internal header for use in other parts of the library is named foo_internal.h
  • A private header for use in a component is named foo_private.h
  • The MASTER/MAIN ifdef scheme in the main header file is no longer used
  • Unclear if we should keep hproto.h

This scheme uses "private" in a different sense than the HDF5 library, so we may want to reconsider this naming scheme. It does maintain the original HDF4 library sense of "internal", though, and uses "private" in the OO sense, which HDF5 does not.

Clone this wiki locally