### Calling Conventions for Subsystem Functions

Calling Conventions for Windows
When creating a subsystem, you can use the __cdecl, __stdcall, _System (which defaults to __stdcall) or _Optlink calling convention for your functions. Any external functions that will be called from programs not compiled by IBM C and C++ Compilers must use the __cdecl convention.

You can use the /Mp, /Ms, /Mc, and Mt options (for _Optlink, _System, __cdecl, and __stdcall, respectively) to specify the default calling convention for all functions in a program. You can use linkage keywords to specify the convention for individual functions.

Calling Conventions for OS/2
When creating a subsystem, you can use either the _System or _Optlink calling convention for your functions. Any external functions that will be called from programs not compiled by the IBM C and C++ Compilers must use the _System convention.

You can use the /Mp or /Ms options to specify the default calling convention for all functions in a program, and you can use linkage keywords or #pragma linkage to specify the convention for individual functions.

Note: The #pragma linkage directive is supported for C programs only.

Calling Conventions

Summary of Subsystem Library Functions