Note: This directive is obsolete in this release of IBM C and C++ Compilers. Avoid using it in new code. For your new applications, use linkage keywords to specify the calling convention for a function. Linkage keywords are easier to use than is the #pragma linkage directive, and they let you declare both the function and its linkage type in one statement.
The #pragma linkage directive identifies the linkage or calling convention used on a function call.
The identifier identifies either the name of the function that will be given the particular linkage type or the name of a typedef that resolves to a function type. If identifier is a typedef, any function declared using identifier will be given the particular linkage type.
The following example shows how to use a typedef to declare
functions and pointers to functions of _System linkage:
#pragma linkage(functype, system) typedef int functype(int); functype f; /* f is a function with _System linkage */ functype *fp; /* fp is a pointer to a function with _System linkage */
The IBM C and C++ Compilers default linkage is _Optlink, which is a convention specific to the IBM C and C++ Compilers product.
The
_Far16 linkage conventions indicate that a function has a 16-bit
linkage type. Pascal and _pascal are equivalent, and specify C/2
pascal linkage. If far16 is specified without a parameter,
__cdecl linkage is used.
The cdecl and _ cdecl options are equivalent. The underscore is optional, and is accepted for compatibility with C/2 cdecl linkage declarations.
You can use compiler options to explicitly set the calling conventions. A linkage keyword or #pragma linkage directive overrides the compiler option.