Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 35
Program Declarations
Program Declarations
The particular declarations required by an active backup program depend on the
application. The following are used in this example.
#include and #pragma Lines
The following #include and #pragma lines provide the declarations required by the
program. The conditional statement #ifdef _TNS_R_TARGET causes the lines that
follow it to be included only for native programs, while the lines that are between the
#else line and the #endif line are included only for TNS and accelerated programs.
For native programs, the pragmas search "$system.system.crtlns" and
runnamed must be included in the compiler command line.
#ifdef _TNS_R_TARGET
/* for native programs only */
#include <crtlnsh> nolist
/* Note: Include the pragmas 'search "$system.system.crtlns"'
*/
/* and "runnamed" in the compiler command line for
*/
/* native programs.
*/
#else
/* for TNS and accelerated programs only /*
#pragma wide
#pragma search "$system.system.cnonstop"
#include <nonstoph> nolist
#endif
#include <stringh> nolist
#include <stdioh> nolist
#include <talh> nolist
#include <cextdecs (FILE_GETRECEIVEINFO_,
FILE_OPEN_,
MONITORCPUS,
PROCESS_GETINFO_,
PROCESS_GETPAIRINFO_,
PROCESS_SETINFO_,
PROCESSHANDLE_COMPARE_,
PROCESSHANDLE_DECOMPOSE_,
READUPDATEX,
REPLYX,
WRITEX)> nolist
#include "$system.zsysdefs.zsysc
(zsys_ddl_phandle,zsys_ddl_receiveinformation)" nolist
#include "$system.zspidef.zfilc (constants)" nolist