Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

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.

NOTE:

For 32-bit applications, use of the STDCALL calling convention means that the called procedure controls the stack. The code to restore the stack resides in the called procedure, so the code needs to appear only once. For 64-bit applications, the stack adjustment and @n name suffix features of STDCALL are not used.

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.