Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide

Calling conventions

Understanding linkage considerations
OPTLINK linkage
Features of OPTLINK
Tips for using OPTLINK
General-purpose register implications
Parameters
Examples of passing parameters
Passing conforming parameters to a routine
SYSTEM linkage
Features of SYSTEM
Example using SYSTEM linkage
STDCALL linkage (Windows only)
Features of STDCALL
Examples using the STDCALL convention
Using WinMain (Windows only)
CDECL linkage
Features of CDECL
Examples using the CDECL convention

This chapter discusses the calling conventions used by PL/I for Windows:

The OPTLINK linkage convention (see OPTLINK linkage for details) is also supported by VisualAge for C++ (OS/2 and Windows) and is the fastest method of calling PL/I procedures, C functions, or assembler routines. OPTLINK is not, however, standard for all Windows applications.

On Windows, specifying SYSTEM linkage is synonymous with STDCALL linkage and is implemented the same as STDCALL. The compiler, however, considers the names SYSTEM and STDCALL to be distinct and complains if you mix them. The STDCALL linking convention is described in STDCALL linkage (Windows only).

You can specify the calling convention for all functions within a program using the LINKAGE suboption of the DEFAULT compile-time option. You can also use the LINKAGE option of the OPTIONS attribute to specify the linkage for individual functions.

Note:
You cannot call a function using a different calling convention than the one with which it is compiled. For example, if a function is compiled with SYSTEM linkage, you cannot later call it specifying OPTLINK linkage.

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)