### /M Compiler Option

Syntax: | Default:
/M[p|s|c|t] | /Mp

Use /M to set the default calling convention, as follows:

Option | Calling Convention
/Ms | _System
/Mc | __cdecl
/Mt | __stdcall
/Mp | _Optlink

The default is the _Optlink calling convention (/Mp).

You must include the header files for libraries that use a different calling convention from the one you specify. The libraries use the following calling conventions:

IBM C and C++ Compilers | Functions use the _Optlink calling convention. Include the IBM C and C++ Compilers library header files to call IBM C and C++ Compilers functions when you set /Ms, /Mc, or /Mt.
Toolkit libraries | APIs use the __stdcall calling convention. Include the Toolkit library header files to call Windows APIs when you set /Mp (the default), /Mc, or /Mt.

If you do not include the header files, then your code will attempt to call functions with the calling convention you set, rather than with the calling convention the function requires.

Summary of Compiler Options