HP-UX SNAplus2 CPI-C Programmer's Guide (June 2003)
CPI-C Calls
Information Provided for CPI-C Calls
Chapter 3116
To improve the portability of CPI-C applications, the data types for the
parameters supplied to, and received from, CPI-C are established as
symbolic constants by #define statements in the CPI-C header file. For
example, CM_INT32 represents a 32-bit integer type; CM_PTR
represents a pointer type, “*” on HP-UX and Win32 systems.
This chapter uses these symbolic constants to identify the data types for
supplied and returned parameters. When writing applications, you are
advised to use these symbolic constants rather than the actual data
types.
Data Structures
This section does not apply to Java CPI-C applications, because none of
the CPI-C functions supported in Java CPI-C use data structures.
For some CPI-C calls, the application supplies a data structure in which
SNAplus2 can fill in parameters to return to the application. These data
structures may contain parameters marked as “reserved”; some of these
reserved parameters are used internally by the SNAplus2 software, and
others are not used in this version but may be used in future versions.
Your application must not attempt to access any of these reserved
parameters; instead, it must set the entire contents of the data structure
to zero to ensure that all of these parameters are zero, before it sets other
parameters that are used by the verb. This ensures that SNAplus2 will
not misinterpret any of its internally-used parameters, and also that
your application will continue to work with future SNAplus2 versions in
which these parameters may be used to provide new functions.
To set the data structure contents to zero, use memset:
memset(my_struct, 0, sizeof(my_struct));
Symbolic Constants
For information on symbolic constant values in Java CPI-C applications,
see “Java CPI-C Considerations” in Chapter 2.
Most parameters supplied to and returned by CPI-C are 32-bit integers.
To simplify coding, the values for these parameters are represented by
meaningful symbolic constants, which are established by #define
statements in the header file. For example, the value