Wrapper

May 22, 2020 ยท View on GitHub

The wrapper allows wrapping Fortran statements in C declations

$ fsource wrap [--fixed-form] FILENAME [FILENAME ...]

The result is a C header file.

Exact type maps

The following maps are exact:

Fortraniso_c_binding KINDsizeofC typenumpy dtype
LOGICALc_bool1_Boolbool_
CHARACTERc_char1charchar
INTEGERc_intintintc
INTEGERc_shortshortshort
INTEGERc_longlongint_
INTEGERc_long_longlong longlonglong
INTEGERc_signed_char1signed charbyte
INTEGERc_size_tssize_tintp
INTEGERc_int8_t1int8_tint8
INTEGERc_int16_t2int16_tint16
INTEGERc_int32_t4int32_tint32
INTEGERc_int64_t8int64_tint64
INTEGERc_intptr_tintptr_tintp
INTEGERc_ptrdiff_tptrdiff_tintp
REALc_float4floatfloat32
REALc_double8doublefloat64
REALc_long_doublelong doublelongdouble
COMPLEXc_float_complex8float _Complexcomplex64
COMPLEXc_double_complex16double _Complexcomplex128
COMPLEXc_long_double_complexlong double _Complexclongdouble

The sizeof column indicates, e.g., that INTEGER*4 is equivalent to int32_t, which is true on major (all?) platforms.