C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiling and Linking TNS/R Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
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, in
addition to 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 NonStop 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>
Table 16-2. Locations of Header Files
Environment Location
Guardian $SYSTEM.SYSTEM and $SYSTEM.ZTCPIP
OSS /usr/include and its subdirectories
PC TDS:
\TDMXDEV\rel\INCLUDE
ETK < version 3.0:
\Compaq ETK-NSE\rel\include
ETK Version 3.0 and later:
\Compaq ETK-NSE\rel\usr\include
where rel represents the release version update, such as D45.01