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

Table Of Contents
Interfacing to Guardian Procedures and OSS
Functions
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
3-6
Procedures With 16-Bit Addressable Parameters
Procedures With 16-Bit Addressable Parameters
Native C and C++ programs do not support 16-bit addressable parameters. All
Guardian procedures called from native programs use 32-bit addressable parameters.
This subsection applies only to TNS C and C++ programs.
Some Guardian procedures require 16-bit addressable parameters. 16-bit addressable
parameters are located in the user data segment instead of an extended data
segment. Guardian procedures that require 16-bit addressable parameters have
corresponding versions that require 32-bit addressable parameters. For example,
READ requires 16-bit parameters and READX requires 32-bit parameters. Use the
Guardian procedures with 32-bit addressable parameters in new code and consider
converting old code as well.
Parameters located in the user data segment need to be declared and passed
properly. Small-memory model TNS C programs only support 16-bit addressable data
so no changes are required. Large-memory model and 32-bit (or wide) data model
TNS C and C++ programs require you to use the NOXVAR pragma or the _near
pointer modifier to denote aggregates that are to be stored in the user data segment.
See XVAR on page 13-117 or Attribute Specifier on page 2-10.
Procedures That You Cannot Call
C and C++ programs can call most but not all Guardian procedures. For example, they
cannot call the Guardian INITIALIZER and ARMTRAP procedures. To determine
whether a Guardian procedure can be called from a C or C++ program, see the
procedure’s reference page in the Guardian Procedure Calls Reference Manual.
C and C++ programs cannot directly call Guardian procedures that both return a value
and return a condition code. The subsections TAL Procedures That You Cannot
Directly Call on page 7-12 and pTAL Procedures That You Cannot Call Directly on
page 8-11 present techniques that enable you to access procedures in this category.
Declaring OSS Functions
Unlike Guardian procedures that are written in TAL or pTAL, Open System Services
(OSS) functions are written in C. Therefore, to declare OSS functions, you need only to
specify library header files that contain the prototype definitions for OSS functions
called from your program. To determine the correct header files to specify, see the
Open System Services System Calls Manual, the Open System Services Library Calls
Manual, or the reference page for a particular function.
C and C++ programs that run in the Guardian environment cannot call all OSS
functions. For more details, see the Open System Services Programmers Guide.