TNS/R Native Application Migration Guide
C and C++ Migration Tasks
TNS/R Native Application Migration Guide—523745-001
3-16
Using Active Backup Programming in C
Using Active Backup Programming in C
To migrate a TNS program that uses the active backup programming functions to
native mode:
•
Replace the header file nonstop.h with crtlns.h.
•
Instead of binding in cnonstop, link the active backup support library:
See the Guardian Programmer’s Guide for more details on writing programs that use
the active backup functions.
Replacing Obsolete C++ Library Operations
The TNS C++ run-time library uses the TNS Guardian C library alternate-model I/O
functions to provide an I/O facility similar to but not identical to the UNIX file descriptor
model. To improve interoperability between the Guardian and OSS environments, the
native environment does not support the Guardian alternate-model I/O functions.
Because of this change, the Guardian native C++ run-time library filebuf and
fstream classes cannot be used to specify an existing open file stream with the
attach function. There are two options available to programs that use the alternate-
model I/O functions:
•
Rewrite your code to use the Open System Services (OSS) versions of these
classes.
•
Open the file stream instead of using a file descriptor to attach to an existing open
stream.
The attach function’s use of file descriptors is nonstandard behavior.
Using the Tools.h++ Class Library
The header files for D30.02 and later RVUs of the Tools.h++ class library have been
restructured to take advantage of the CPATHEQ and MAPINCLUDE pragmas. These
pragmas enable source code to specify file names that differ from Guardian file names
in #include statements. For examples, these pragmas enable common source code
to be maintained for Guardian and UNIX file systems.
•
In source files, change references to header files rwlocal.h and rwgener.h
with locale.h and generic.h, respectively.
•
In source files, change references to header filenames starting with
“$system.zrw” to “rw/”.
Environment Active Backup Support Library
Guardian CRTLNS
OSS or PC crtlns.o