iso_c_binding
is a standard intrinsic module which defines named constants, types, and procedures for C interoperability.
Fortran 2003 and later
The following intrinsic procedures are provided by the module; their definition can be found in the section Intrinsic Procedures of this manual.
The iso_c_binding
module also provides the following named constants of type default integer, which can be used as kind
type parameters.
Fortran Type | Named constant | C type | Note |
---|---|---|---|
integer | c_int | int | |
integer | c_short | short int | |
integer | c_long | long int | |
integer | c_long_long | long long int | |
integer | c_signed_char | signed char /unsigned char | |
integer | c_size_t | size_t | |
integer | c_int8_t | int8_t | |
integer | c_int16_t | int16_t | |
integer | c_int32_t | int32_t | |
integer | c_int64_t | int64_t | |
integer | c_int_least8_t | int_least8_t | |
integer | c_int_least16_t | int_least16_t | |
integer | c_int_least32_t | int_least32_t | |
integer | c_int_least64_t | int_least64_t | |
integer | c_int_fast8_t | int_fast8_t | |
integer | c_int_fast16_t | int_fast16_t | |
integer | c_int_fast32_t | int_fast32_t | |
integer | c_int_fast64_t | int_fast64_t | |
integer | c_intmax_t | intmax_t | |
integer | c_intptr_t | intptr_t | |
integer | c_ptrdiff_t | intptr_t | TS 29113 |
real | c_float | float | |
real | c_double | double | |
real | c_long_double | long double | |
complex | c_float_complex | float _Complex | |
complex | c_double_complex | double _Complex | |
complex | c_long_double_complex | long double _Complex | |
logical | c_bool | _Bool | |
character | c_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 | '\' |
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.