C/C++ Programmer's Guide (G06.25+)
Compiling and Linking TNS/R Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
16-3
Specifying Header Files
•
You cannot use the SSV pragma. However, you can specify search directories
using the c89 -I flag.
Specifying Header Files
The macros and functions in the C run-time library are declared in header files. Each
header file contains declarations for a related set of library functions and macros, as
well as variables and types that complete that set. If you use a function in the library,
you should include the header file in which it is declared. You should not declare the
routine yourself because the declarations in the header files have provisions for
several situations that can affect the form of a given declaration, including:
•
Whether the routine is implemented internally as a function or a macro
•
Whether the function is written in a language other than C
•
Whether you are compiling for the small- or large-memory model
•
Whether you are compiling for the 16-bit or 32-bit (wide) data model
•
Whether you are compiling for the Guardian or OSS environment
•
Whether you are compiling for TNS mode or native mode
In addition, the header file prototype declarations enable the compiler to check
parameters and arguments for compatibility, ensuring that function calls provide the
correct number and type of arguments.
A single set of C library header files supports all three environments (Guardian, OSS,
and PC) and both modes (TNS and native). The locations of the header files in the
three environments is summarized in Table 16-2.
To specify header files, use the #include preprocessor directive. For example, to
include the STDIO header file, specify in your object file:
#include <stdio.h>
You might also need to specify header files for the Standard C++ Library and Tools.h++
library in order to use functions contained in those libraries. For examples of
#include directives for these libraries, see Section 5, Using the Standard C++ Library
Table 16-2. Locations of Header Files
Environment Location
Guardian $SYSTEM.SYSTEM and $SYSTEM.ZTCPIP
OSS /usr/include and its subdirectories
PC Tandem Development Suite:
\TDMXDEV\rel\INCLUDE
HP Enterprise Toolkit < version 3.0:
\Compaq ETK-NSE\rel\include
HP Enterprise Toolkit Version 3.0 and later:
\Compaq ETK-NSE\rel\usr\include
where rel represents the release version update, such as D45.01