Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Stack Considerations in Calling Conventions on Windows

In the C calling convention, which is the default, the calling routine always adjusts the stack immediately after the called routine returns control. This process produces slightly larger object code because the code that restores the stack must exist at every point a procedure is called.

The C calling convention makes calling with a variable number of arguments possible. In the C calling convention, the caller cleans up the stack, so it is possible to write a routine with a variable number of arguments. Therefore, the return point has the same address relative to the frame pointer, regardless of how many arguments are actually passed. The calling routine controls the stack, knows how many arguments it passed, how big they are, and where they reside in the stack. It can skip passing an argument and still keep track.

You can call routines with a variable number of arguments by including the ATTRIBUTES C option in your interface to a routine.