インテル® Fortran コンパイラー 14.0 ユーザー・リファレンス・ガイド
The ATTRIBUTES directive options C and STDCALL specify procedure calling, naming, and argument passing conventions.
!DIR$ ATTRIBUTES C :: object[, object] ...
!DIR$ ATTRIBUTES STDCALL :: object[, object] ...
object |
Is the name of a data object or procedure. |
On W*S only (see Notational Conventions, Platform labels), C and STDCALL have slightly different meanings; on all other platforms, they are interpreted as synonyms.
When applied to a subprogram, these options define the subprogram as having a specific set of calling conventions.
The following table summarizes the differences between the calling conventions:
Convention |
C 1 |
STDCALL 1 |
Default 2 |
---|---|---|---|
Arguments passed by value |
Yes |
Yes |
No |
Case of external subprogram names |
L*X, M*X: Lowercase W*S: Lowercase |
L*X, M*X: Lowercase W*S: Lowercase |
L*X, M*X: Lowercase W*S: Uppercase |
L*X, M*X only: |
|||
Trailing underscore added |
No |
No |
Yes3 |
M*X only: |
|||
Leading underscore added |
No |
No |
Yes |
W*S only: |
|||
Leading underscore added |
Yes |
Yes |
Yes4 |
Number of argument bytes added to name |
No |
Yes |
No |
Caller stack cleanup |
Yes |
No |
Yes |
Variable number of arguments |
Yes |
No |
Yes |
1C and STDCALL are synonyms on Linux* OS. 2The Intel® Fortran calling convention 3On Linux* OS, if there are one or more underscores in the external name, two trailing underscores are added; if there are no underscores, one is added. 4W*S only |
If C or STDCALL is specified for a subprogram, arguments (except for arrays and characters) are passed by value. Subprograms using standard Fortran conventions pass arguments by reference.
On IA-32 architecture, an underscore ( _ ) is placed at the beginning of the external name of a subprogram. If STDCALL is specified, an at sign (@) followed by the number of argument bytes being passed is placed at the end of the name. For example, a subprogram named SUB1 that has three INTEGER(4) arguments and is defined with STDCALL is assigned the external name _sub1@12.
Character arguments are passed as follows:
By default, hidden lengths are put at the end of the argument list.
On Windows* systems using IA-32 architecture, you can get Compaq* Visual Fortran default behavior by specifying compiler option iface.
If C or STDCALL (only) is specified:
On all systems, the first character of the string is passed (and padded with zeros out to INTEGER(4) length).
If C or STDCALL is specified, and REFERENCE is specified for the argument:
On all systems, the string is passed with no length.
If C or STDCALL is specified, and REFERENCE is specified for the routine (but REFERENCE is not specified for the argument, if any):
On all systems, the string is passed with the length.