ILE C/C++ Programmer's Guide


ILE Conventions for Calling Any Program (*PGM)

If you have an ILE C/C++ program calling a program (*PGM), use the OS calling convention for ILE C/C++ in your ILE C/C++ source to tell the compiler that PGMNAME is an external program, not a bound ILE procedure.

Note:
The OS calling convention for ILE C is the #pragma linkage (PGMNAME, OS) directive. The OS calling convention for ILE C++ is extern "OS".

This section provides examples that illustrate dynamic program call conventions for ILE C/C++ programs that call any external program. As shown in Table 19, ILE C uses the same convention when calling all external programs other than an EPM entry point.

Table 19. Dynamic Program Calling Conventions

Action Program Call Convention
ILE C calling *PGM where *PGM is
  • ILE C
  • OPM COBOL for iSeries
  • OPM RPG for iSeries
  • OPM CL
  • OPM BASIC
  • OPM PL/1
  • EPM C
  • EPM PASCAL
  • EPM FORTRAN/400(R)
  • ILE COBOL for iSeries
  • ILE RPG for iSeries
  • ILE CL
  • C++
#pragma linkage (PGMNAME, OS)

For example,



void PGMNAME(void);
#pragma linkage (PGMNAME, OS)
/* Other code */
/* Dynamic call to program PGMNAME */
PGMNAME();
ILE C calling an EPM entry point #pragma linkage (QPXXCALL, OS)

For example,



#include <xxenv.h>
/* The xxenv.h header file holds */
/* the prototype for QPXXCALL */
/* The #pragma linkage (QPXXCALL, OS) */
/* is in this header file. */
/* Other code. */
/* Dynamic call to program QPXXCALL. */
/* Dynamic call to EPM entry point using QPXXCALL: */
/* the name of the entry point is entname, envid */
/* names the user-controlled environment, the */
/* program and library name is given by envpgm, */
/* parm1 and parm2 are arguments passed to entname. */
QPXXCALL(entname, envid, &envpgm, parm1, parm1);


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