Guardian Programmer's Guide

Table Of Contents
Introduction to Guardian Programming
Guardian Programmer’s Guide 421922-014
1 - 19
Calling Guardian Procedures From C or C++
The above ?SOURCE directive copies into your program for compilation the external
declarations for only the FILE_OPEN_, FILE_CLOSE_, READX, WRITEX, and
WRITEREADX procedures.
Multiple versions of the external declarations file are available in case you might need
to run your program on older versions of the operating system as well as the current
version. Specify the version of your choice as follows:
For example, if the current version of the operating system is D40, EXTDECS0 relates
to release D40, EXTDECS1 relates to release D30, and EXTDECS relates to release
D20.
Because the version is specified by a relative value, there is no need to constantly
update the level of the external declarations file used in your programs. If you specify
the level as EXTDECS0, your programs will always use the current version of the
external declarations file.
Calling Guardian Procedures From C or C++
HP C provides a library file known as the cextdecs header to help you make calls to
Guardian procedures from the C and C++ languages. The cextdecs header contains
C-coded declarations that enable most of the Guardian procedures to be called directly
through C or C++ function calls. However, some declarations are not found in the
cextdecs header, but are found in other C header files instead. Refer to the
Guardian Procedure Calls Reference Manual for information about where declarations
are to be found for a particular Guardian procedure.
Guardian procedures that return both a return value and a condition code cannot be
called directly from C or C++, nor can Guardian procedures that take the name of
another procedure as a parameter. For each of these calls you must:
Supply a “jacket” procedure in a TAL module. This jacket procedure must call the
desired Guardian procedure and then return the information to the caller of the
jacket procedure in a way that can be handled by the C or C++ function.
Provide a function declaration in your C or C++ program to call the jacket
procedure.
The C/C++ Programmers Guide provides complete details on how to call all Guardian
procedures from a C or C++ program, whether the call is direct or indirect.
For information on when and how to use calls to the Guardian procedures in your C or
C++ program, you should continue to read this guide. Although most of the examples
are given in TAL, the program logic is similar for both languages.
EXTDECS0 the current operating system version
EXTDECS1 the current version minus 1
EXTDECS the current version minus 2