Intel® Fortran Compiler 17.0 Developer Guide and Reference
General Compiler Directive: Declares properties for specified variables.
!DIR$ ATTRIBUTES att[,att]...:: object[,object]...
att |
Is one of the following options (or properties): |
object |
Is the name of a data object or procedure. |
The following table shows which ATTRIBUTES options can be used with various objects:
Option |
Variable and Array Declarations |
Common Block Names 1 |
Subprogram Specification and EXTERNAL Statements |
---|---|---|---|
ALIAS |
No |
Yes |
Yes |
ALIGN |
Yes |
No |
No |
ALLOCATABLE |
Yes2 |
No |
No |
ALLOW_NULL |
Yes |
No |
No |
C |
No |
Yes |
Yes |
CODE_ALIGN |
No |
No |
Yes5, 6 |
CONCURRENCY_SAFE |
No |
No |
Yes |
CVF |
No |
Yes |
Yes |
DECORATE |
No |
No |
Yes |
DEFAULT |
No |
Yes |
Yes |
DLLEXPORT |
Yes3 |
Yes |
Yes |
DLLIMPORT |
Yes |
Yes |
Yes |
EXTERN |
Yes |
No |
No |
FASTMEM |
Yes |
No |
No |
FORCEINLINE |
No |
No |
Yes |
IGNORE_LOC |
Yes4 |
No |
No |
INLINE |
No |
No |
Yes |
MIXED_STR_LEN_ARG |
No |
No |
Yes |
NO_ARG_CHECK |
Yes |
No |
Yes5 |
NOCLONE |
No |
No |
Yes |
NOINLINE |
No |
No |
Yes |
OFFLOAD |
Yes |
No |
Yes |
OPTIMIZATION_PARAMETER |
No |
No |
Yes5, 6 |
REFERENCE |
Yes |
No |
Yes |
STDCALL |
No |
Yes |
Yes |
VALUE |
Yes |
No |
No |
VARYING |
No |
No |
Yes |
VECTOR |
No |
No |
Yes5 |
1A common block name is specified as [/]common-block-name[/] 2This option can only be applied to arrays. 3Module-level variables and arrays only. 4This option can only be applied to INTERFACE blocks. 5This option cannot be applied to EXTERNAL statements. 6This option can be applied to named main programs. |
These options can be used in function and subroutine definitions, in type declarations, and with the INTERFACE and ENTRY statements.
Options applied to entities available through use or host association are in effect during the association. For example, consider the following:
MODULE MOD1
INTERFACE
SUBROUTINE NEW_SUB
!DIR$ ATTRIBUTES C, ALIAS:'othername' :: NEW_SUB
END SUBROUTINE
END INTERFACE
CONTAINS
SUBROUTINE SUB2
CALL NEW_SUB
END SUBROUTINE
END MODULE
In this case, the call to NEW_SUB within SUB2 uses the C and ALIAS options specified in the interface block.
Options C, STDCALL, REFERENCE, VALUE, and VARYING affect the calling conventions of routines:
INTERFACE
SUBROUTINE For_Sub (I)
!DIR$ ATTRIBUTES C, ALIAS:'_For_Sub' :: For_Sub
INTEGER I
END SUBROUTINE For_Sub
END INTERFACE
You can assign more than one option to multiple variables with the same compiler directive. All assigned options apply to all specified variables. For example:
!DIR$ ATTRIBUTES REFERENCE, VARYING, C :: A, B, C
In this case, the variables A, B, and C are assigned the REFERENCE, VARYING, and C options. The only restriction on the number of options and variables is that the entire compiler directive must fit on one line.
The identifier of the variable or procedure that is assigned one or more options must be a simple name. It cannot include initialization or array dimensions. For example, the following is not allowed:
!DIR$ ATTRIBUTES C :: A(10) ! This is illegal.
The following shows another example:
SUBROUTINE ARRAYTEST(arr)
!DIR$ ATTRIBUTES DLLEXPORT :: ARRAYTEST
REAL(4) arr(3, 7)
INTEGER i, j
DO i = 1, 3
DO j = 1, 7
arr (i, j) = 11.0 * i + j
END DO
END DO
END SUBROUTINE