Multimedia Extensions Calling Convention

Like Windows, the Multimedia extensions use the Pascal calling convention, which operates as follows:

Parameters are pushed onto the stack in the order in which they appear in the function call.

The code that restores the stack is part of the called function (rather than the calling function).

This convention differs from the calling convention used in some languages, such as C. In C, parameters are pushed onto the stack in reverse order, and the calling function is responsible for restoring the stack.

When developing applications using the Multimedia extensions in C (or any other language that doesn't ordinarily use the Pascal calling convention), use the Pascal calling convention for any Multimedia extensions functions called by your application. In C, use the PASCAL keyword when declaring the function, as shown in the following example:

BOOL FAR PASCAL midiOutGetNumDevs()

The WINDOWS.H header file declares prototypes for all standard Windows functions. The MMSYSTEM.H, MMP.H, and DISPDIB.H header files declare prototypes for all Multimedia extensions functions. The declarations in these header files use the Pascal calling convention.