Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
Use of Feature Test Macros
The C compiler provides feature test macros, for example: _POSIX_SOURCE, _POSIX_C_SOURCE,
_XOPEN_SOURCE, and _TANDEM_SOURCE. Sometimes options are also selected by macros.
For example, _IGNORE_LOCALE is used in ctype.h to select C/POSIX locale macros rather than
internationalized functions. Use of these macros determine whether a particular set of features will
be included from header files. Feature test macros also enable you to check how well a program
compiles.
The C header files contain definitions required by the ISO/ANSI C standard, the POSIX.1 standard,
the POSIX.2 standard, and the XPG4 specifications. You control visibility of the definitions with
feature test macros. If a program does not conform to the POSIX-standard or XPG4 specification
identifiers made visible by a feature test macro, the compiler issues error and warning messages.
For more information about feature test macros, refer to the C/C++ Programmer’s Guide. See also
“Defined Symbols and Header Files” (page 117).
Function Entry Points Defined in Header Files
In the Guardian environment, header files are in $SYSTEM.SYSTEM by default. In the OSS
environment, header files are in /usr/include and its subdirectories by default. For Guardian
and OSS processes on TNS and native systems, these files support different combinations of memory
and data models. For information about these different memory and data models, see “Memory
and Data Models in TNS and Native Environments” (page 140).
For TNS processing environments, the proper entry point to the system is determined by
compiler-defined symbols. In general, you do not need to be concerned with the details of how
the proper entry point is selected in the header files. Selection involves the use of the appropriate
pragmas in the source code or symbol definitions in the compiler command line. Reasonable
defaults are used in each of the environments.
Role of the cextdecs.h File for Accessing Guardian Procedures
C programs can access Guardian system procedures by including sections from the header file
cextdecs.h file in the OSS environment. The cextdecs.h file contains function prototype
declarations for the system procedures you can call directly from your C program.
cextdecs.h specifies the C names for the system procedures with uppercase characters, and
provides a section for each procedure using the SECTION pragma. It declares system procedures
that return condition codes as TAL procedures returning _cc_status. Consequently, you must
include the header tal.h before you call such a system procedure. See “Checking the Condition
Code ” (page 175) for using condition codes in the TNS/R and TNS/E native environments.
To access the declarations in cextdecs.h, use the #include directive, specifying the names
of the system procedures you want to include as section names. The following example includes
the declarations of the PROCESS_GETINFOLIST_ and FILENAME_FINDNEXT_ Guardian procedures:
#include <cextdecs.h(PROCESS_GETINFOLIST_,FILENAME_FINDNEXT_)>
The syntax of a system procedure call determines whether a parameter is required or is optional.
To call system procedures with optional parameters, you can omit the parameter, but must include
the comma that would follow it. For example:
ERR = FILENAME_SCAN_ (string,length,count,,,options);
API Interoperability
Interoperability of the Guardian and OSS environments on the same system refers to:
• The ability of a program to utilize the API of either environment
• The ability of one API to access or manipulate objects of the other environment
• The ability of utilities to access or manipulate objects of the other environment
API Interoperability 73