ILE C/C++ Programmer's Guide

Declaring OS/400 pointer Variables in C and C++

Pointers to *PGM objects (programs) can be declared in either of the following ways:

You can declare variables of the other iSeries 400 pointer types by using the type definitions (typedefs) that are provided by the ILE C <pointer.h> header file.

Figure 188 shows iSeries C pointer declarations. Figure 189 shows iSeries C++ pointer declarations.

Figure 188. ILE C Source to Declare Pointer Variables




#include <pointer.h> /* The pointer header file. */
_SYSPTR sysp; /* A system pointer. */
_SPCPTR spcp; /* A space pointer. */
_INVPTR invp; /* An invocation pointer. */
_OPENPTR opnp; /* An open pointer. */
_LBLPTR lblp; /* A label pointer. */
void (*fp) (int); /* A function pointer. */
#pragma datamodel (p128)
#pragma linkage (OS_FN_T, OS)
#pragma datamodel(pop)
typedef void (OS_FN_T) (int); /* Typedef of an OS-linkage function.*/
OS_FN_T * os_fn_p; /* An OS-linkage function pointer. */
int * ip; /* A pointer to a data object. */

Figure 189. ILE C++ Source to Declare Pointer Variables




#include <pointer.h> /* The pointer header file. */
_SYSPTR sysp; /* A system pointer. */
_SPCPTR spcp; /* A space pointer. */
_INVPTR invp; /* An invocation pointer. */
_OPENPTR opnp; /* An open pointer. */
_LBLPTR lblp; /* A label pointer. */
void (*fp) (int); /* A function pointer. */
#pragma datamodel (p128)
/* Typedef of an OS-linkage function. */
extern "OS" typedef void (OS_FN_T) (int);
#pragma datamodel(pop)
int * ip; /* A pointer to a data object. */


[ Top of Page | Previous Page | Next Page | Table of Contents ]