HP-UX SNAplus2 CPI-C Programmer's Guide (June 2003)
Writing CPI-C Applications
HP-UX Considerations
Chapter 2 99
Two or more instances of the same program can run as different
processes, but each instance will be assigned its own conversation_ID.
You can write an application in which one process contains many
conversations, each with its own conversation_ID. However, you need
to design the application carefully to avoid “deadlock” situations, in
which a CPI-C call is unable to complete because of the state of other
conversations in the same process. This might happen if the program is
waiting on one conversation for information to be sent to it before
returning some other data, and another conversation from the same
process is waiting for this data before it can send the information
originally required by the first conversation. To some extent this can be
avoided by using a separate process for each conversation.
Compiling and Linking the CPI-C Application
Applications are compiled with different options in order to select one of
the scheduling modes described in “Single-Threaded Applications”.
NOTE Applications linked with previous versions of SNAplus2 that used
signal-based scheduling mode and the single-threaded library,
libmgr.sl, will continue to work in the current version of SNAplus2.
However, this library is provided only for back-compatibility. New
applications should not use this library.
When compiling your CPI-C application, specify the following option to
indicate to the compiler which directory contains the SNAplus2 header
files your application requires:
-I /usr/include/sna
When linking your CPI-C application, use the following options:
-L Indicates the directory containing one or more libraries
to be used when linking the application.
-l Indicates the name of a library to be used when linking
the application.
The command you use to link the application depends on which type of
application it is, as described below.