Lahey/GNU Fortran

Next: , Previous: ISO_FORTRAN_ENV, Up: Intrinsic Modules


9.2 ISO_C_BINDING

Standard:
Fortran 2003 and later, GNU extensions

The following intrinsic procedures are provided by the module; their definition can be found in the section Intrinsic Procedures of this manual.

C_ASSOCIATED
C_F_POINTER
C_F_PROCPOINTER
C_FUNLOC
C_LOC
C_SIZEOF

The ISO_C_BINDING module provides the following named constants of type default integer, which can be used as KIND type parameters.

In addition to the integer named constants required by the Fortran 2003 standard, GNU Fortran provides as an extension named constants for the 128-bit integer types supported by the C compiler: C_INT128_T, C_INT_LEAST128_T, C_INT_FAST128_T. Furthermore, if __float is supported in C, the named constants C_FLOAT128, C_FLOAT128_COMPLEX are defined.

Fortran Type Named constant C type Extension
INTEGERC_INT int
INTEGERC_SHORT short int
INTEGERC_LONG long int
INTEGERC_LONG_LONG long long int
INTEGERC_SIGNED_CHAR signed char/unsigned char
INTEGERC_SIZE_T size_t
INTEGERC_INT8_T int8_t
INTEGERC_INT16_T int16_t
INTEGERC_INT32_T int32_t
INTEGERC_INT64_T int64_t
INTEGERC_INT128_T int128_t Ext.
INTEGERC_INT_LEAST8_T int_least8_t
INTEGERC_INT_LEAST16_T int_least16_t
INTEGERC_INT_LEAST32_T int_least32_t
INTEGERC_INT_LEAST64_T int_least64_t
INTEGERC_INT_LEAST128_Tint_least128_t Ext.
INTEGERC_INT_FAST8_T int_fast8_t
INTEGERC_INT_FAST16_T int_fast16_t
INTEGERC_INT_FAST32_T int_fast32_t
INTEGERC_INT_FAST64_T int_fast64_t
INTEGERC_INT_FAST128_T int_fast128_t Ext.
INTEGERC_INTMAX_T intmax_t
INTEGERC_INTPTR_T intptr_t
REAL C_FLOAT float
REAL C_DOUBLE double
REAL C_LONG_DOUBLE long double
REAL C_FLOAT128 __float128 Ext.
COMPLEXC_FLOAT_COMPLEX float _Complex
COMPLEXC_DOUBLE_COMPLEXdouble _Complex
COMPLEXC_LONG_DOUBLE_COMPLEXlong double _Complex
REAL C_FLOAT128_COMPLEX __float128 _Complex Ext.
LOGICALC_BOOL _Bool
CHARACTERC_CHAR char

Additionally, the following parameters of type CHARACTER(KIND=C_CHAR) are defined.

Name C definition Value
C_NULL_CHAR null character '\0'
C_ALERT alert '\a'
C_BACKSPACE backspace '\b'
C_FORM_FEED form feed '\f'
C_NEW_LINE new line '\n'
C_CARRIAGE_RETURN carriage return '\r'
C_HORIZONTAL_TAB horizontal tab '\t'
C_VERTICAL_TAB vertical tab '\v'

Moreover, the following two named constants are defined:

Name Type
C_NULL_PTR C_PTR
C_NULL_FUNPTR C_FUNPTR

Both are equivalent to the value NULL in C.