Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 48
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 header contains the declarations for the
C functions that support fault-tolerant programming. (These functions are
implemented in TAL. By using the nonstoph header, the appropriate TAL
interface code is generated.)
#pragma search "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.
To compile the example program, enter:
c /in source-file/ object-file; runnable, runnamed
To execute the program, enter:
run object-file
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 included 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.
To compile the example program, enter:
nmc /in source-file/ object-file; extensions, runnable, &
runnamed, search "$system.system.crtlns"
To execute the program, enter:
run object-file
Example With Debugging Options
The preceding example is now modified for debugging purposes. Code is added to
enable the user to specify two terminal names as input parameters to the application:
one for debugging the primary process and one for debugging the backup process.
The example can then be run using the Inspect tool to debug the primary and backup
processes from the specified terminals. Details of how this works are as follows.