Visible to Intel only — GUID: GUID-C14AFF9A-0EB5-4D91-8435-BD82C42398D5
Visible to Intel only — GUID: GUID-C14AFF9A-0EB5-4D91-8435-BD82C42398D5
ATTRIBUTES C and STDCALL
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. |
When applied to a subprogram, these options define the subprogram as having a specific set of calling conventions. The effects depend on whether or not the subprogram is interoperable (has the BIND attribute).
For interoperable subprograms, ATTRIBUTES STDCALL and ATTRIBUTES C have no effect. If pass-by-value is desired for a dummy argument to an interoperable subprogram, the Fortran standard VALUE attribute should be specified for that argument.
ATTRIBUTES STDCALL has no effect on interoperable subprograms. You should not specify ATTRIBUTES C for interoperable subprograms.
The following table and subsequent text summarizes the differences between the calling conventions for subprograms that are not interoperable:
Convention |
C 1 |
STDCALL 1 |
Default 2 |
---|---|---|---|
Arguments passed by value |
Yes |
Yes |
No |
Case of external subprogram names |
Linux: Lowercase Windows: Lowercase |
Linux: Lowercase Windows: Lowercase |
Linux: Lowercase Windows: Uppercase |
Linux only: |
|||
Trailing underscore added |
No |
No |
Yes3 |
Windows only: |
|||
Leading underscore added |
Yes |
Yes |
No |
Number of argument bytes added to name |
No |
Yes |
No |
Caller stack cleanup |
Yes |
No |
Yes |
Variable number of arguments |
Yes |
No |
Yes |
1STDCALL is treated as C on Linux*, and on Windows* on Intel® 64 architecture. 2The Intel® Fortran calling convention 3On Linux, if there are one or more underscores in the external name, two trailing underscores are added; if there are no underscores, one is added. |
If C or STDCALL is specified for a subprogram, arguments (except for arrays, large derived types, and characters) are passed by value. Subprograms using standard Fortran conventions pass arguments by reference.
Character arguments are passed as follows:
By default, hidden lengths are put at the end of the argument list. You can override this by specifying option iface.
If C or STDCALL (only) is specified:
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:
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):
The string is passed with the length.
See Also
Compiler Reference section: Mixed Language Programming