Intel® Fortran Compiler 17.0 Developer Guide and Reference
Before the introduction of the Standard Fortran interoperability features, extensions provided by Intel® Fortran were used to facilitate programming using code written in Fortran and C. The Fortran 2003 standard defined new language features for C interoperability; in many cases, these features can be used instead of existing Intel® Fortran extensions. The following table lists the legacy Intel® Fortran extensions and shows their Standard Fortran equivalents.
Existing code using legacy extensions will continue to work; however, if you are writing new code, you should use the standard syntax.
Legacy Extension |
Standard Fortran Interoperability Equivalent |
---|---|
ATTRIBUTES ALIAS |
Use BIND(C,NAME="alias-name"). The BIND(C) syntax also implies ATTRIBUTES DECORATE; the compiler applies whatever name decoration (leading or trailing underscores) that C would use for the name. If the NAME= keyword is omitted, Intel® Fortran will use the Fortran name converted to lowercase on all platforms. If the procedure has no arguments, you must indicate that with () when adding BIND. All arguments to a routine specified as "interoperable" (with BIND(C)) must themselves be interoperable. You can also specify BIND(C) on module variables and COMMON blocks. |
ATTRIBUTES C |
Use BIND(C) (see ALIAS above), which has a similar effect to ATTRIBUTES C except that it does not change the argument passing mechanism to be by-value. Use the Fortran standard VALUE attribute if you need to pass by value. BIND(C) also specifies that small records are passed and returned as function value results the same way C would, which may be different from the Intel® Fortran default. Like ATTRIBUTES C, BIND(C) lowercases the external name and adds any necessary name decoration. |
ATTRIBUTES DECORATE |
Typically used with ATTRIBUTES ALIAS. See ATTRIBUTES ALIAS above. |
ATTRIBUTES DEFAULT |
Not needed when using BIND(C); the compiler always uses the semantics of the C compiler regardless of the setting of command-line options such as iface. |
ATTRIBUTES EXTERN |
Use BIND(C) with a module variable. |
ATTRIBUTES REFERENCE |
Not needed when using BIND(C). Typically used with character arguments, or to override the implicit pass-by-value of ATTRIBUTES C. |
ATTRIBUTES STDCALL |
No equivalent. The use of STDCALL with BIND(C) is supported in Intel® Fortran and, for Windows* on IA-32 architecture only, it changes the external procedure name and stack conventions. For more information, see ATTRIBUTES C and STDCALL. |
ATTRIBUTES VALUE |
Use the Fortran-standard VALUE attribute. This has an additional effect when used with a Fortran procedure; the dummy argument is received by value and then copied to a temporary variable that can be modified within the procedure. Once the procedure exits, the temporary value is discarded. |
ATTRIBUTES VARYING |
No equivalent. |
%LOC function |
Use the C_LOC function from intrinsic module ISO_C_BINDING, which may be an appropriate substitute for variables. C_FUNLOC is the corresponding function for procedures. |
%VAL function |
Declare the argument with the VALUE attribute. |
%REF function |
No equivalent; this is the default when BIND(C) is used. |