Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 65
Compiling and Running the Example
Compiling and Running the Example
If creating a TNS or accelerated program, note the following before compiling, binding,
and running this example:
The nonstoph header is included. This file contains the C library declarations for
active backup programming. (This library is implemented in TAL. By using the
crtlnsh header file, the appropriate TAL interface code is generated.)
#pragma search "$system.system.cnonstop" is specified. This causes
the cnonstop object file to be bound into the program file. This object file
contains the implementation of the C functions that support fault-tolerant
programming.
#pragma wide (for the wide-data model) is specified.
#pragma ANSISTREAMS is specified for compilation of the main function so that
the input and output files are opened as ANSI files rather than EDIT files.
To compile the example program, enter:
c /in source-file/ object-file; runnable
To run the program, enter:
run object-file cfile output-file
where cfile is the C input file and output-file is the output file written by the
program.
If creating a TNS/R native program, note the following before compiling, linking, and
running this example:
The crtlnsh header is included. This header contains the declarations for the
C functions that support fault-tolerant programming. (These functions are
implemented in pTAL. By using the crtlnsh header, the appropriate pTAL
interface code is generated.)
The pragma search "$system.system.crtlns" is specified in the compiler
command line. This causes the CRTLNS object file to be bound into the program
file. This object file contains the implementation of the C functions that support
fault-tolerant programming.
The pragma ANSISTREAMS is specified in the compiler command line so that the
input and output files are opened as ANSI files rather than EDIT files.
To compile the example program, enter:
nmc /in source-file/ object-file; extensions, runnable, &
runnamed, ansistreams, search "$system.system.crtlns"
To execute the program, enter:
run object-file cfile output-file