Use linkage keywords to set linkage conventions for function calls. Each linkage convention has a corresponding keyword that you can use with a function name to set the convention for that function. The keywords are:
Keyword(s) | Description |
_Optlink | IBM C and C++ Compilers default linkage for C++ non-member functions |
_System | System linkage |
__stdcall | Standard calling convention |
__cdecl | C calling convention |
![]() |
32-bit _Pascal linkage |
![]() |
32-bit far _Pascal linkage |
![]() |
16-bit __cdecl linkage |
![]() |
16-bit _Pascal linkage |
![]() |
16-bit _Fastcall linkage |
int _System deborah(int); char (* _Far16 _Cdecl donna)(int);
Linkage keywords take precedence over the compiler options that set calling conventions. If you specify conflicting linkage types for a function using both a #pragma linkage directive and a keyword, an error message is generated and your program will not compile.
Note: Using a keyword is generally quicker and easier than using a #pragma linkage and they let you declare both the function and its linkage type in one statement. Because the #pragma linkage directive is obsolete in this release of IBM C and C++ Compilers, linkage keywords are the preferred method for setting the calling conventions.
#pragma
linkage is not supported at all for C++ functions.