HP-UX SNAplus2 CPI-C Programmer's Guide (June 2003)

Writing CPI-C Applications
Writing Portable Applications
Chapter 2 111
Writing Portable Applications
The following guidelines are provided for writing CPI-C applications that
they are portable to other operating system environments or other CPI-C
implementations:
Include the CPI-C header file without any pathname prefix. Use
include options on the compiler to locate the file (see the appropriate
section for your operating system, earlier in this chapter). This
enables the application to be used in an environment with a different
file system.
Use the symbolic constant names for parameter values and return
codes, not the numeric values shown in the header file; this ensures
that the correct value will be used regardless of the way these values
are stored in memory.
Include a check for return codes other than those applicable to your
current operating system (for example using a “default” case in a
switch statement), and provide appropriate diagnostics.
Some of the CPI-C functions provided by SNAplus2 are extensions
included for compatibility with X/Open CPI-C, or are not part of the
standard CPI-C specification, and may not be available in other
implementations. Each of these extension functions is identified by
notes in the introduction to the function description in Chapter 3,
“CPI-C Calls.
The X/Open functions are included to allow you to use existing
applications written for X/Open CPI-C with SNAplus2. You
should not use these functions when writing new applications.
If you use the extension functions in your application, you may
need to rewrite sections of the application for use in other
environments. You may want to restrict the use of these
functions to a few specific routines, to allow easier modification.
The following guidelines apply to Java CPI-C applications:
The three functions Extract_Conversation_Context,
Set_Conversation_Context, and Set_Local_LU_Name are not part of
the standard CPI-C specification, and are not supported by IBM's
Java CPI-C for CS/NT. If you use these functions in your Java CPI-C
application, you may need to rewrite sections of the application for