1.4 Calling Convention
The Telephony SPI uses the same calling convention as Windows. This calling convention originated in Microsoft Pascal, and is, therefore, referred to as the Pascal calling convention. The Pascal calling convention specifies that:
- 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 that used in 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 in C, or in any language that does not use the Pascal calling convention, you must ensure that you use the Pascal calling convention for all Telephony API functions. In C, this requires you to declare the function with a PASCAL keyword. For example:
LONG FAR PASCAL lineGetDevCaps(...)
Alternatively, you may use the WINAPI macro defined in the Windows header file, as is done in the TSPI header file. For example:
LONG WINAPI lineGetDevCaps(...)