 : set-fortran-abi ( library -- )
     library-fortran-abis get-global at fortran-abi set ;
 
-: (fortran-invoke) ( return library function parameters -- quot )
+: ((fortran-invoke)) ( return library function parameters -- quot )
     {
         [ 2nip [<fortran-result>] ]
         [ nip nip nip [fortran-args>c-args] ]

    [ "__" append ] [ "_" append ] if ;

HOOK: fortran-c-abi fortran-abi ( -- abi )
M: f2c-abi fortran-c-abi cdecl ;
M: g95-abi fortran-c-abi cdecl ;
M: gfortran-abi fortran-c-abi cdecl ;


SINGLETONS: f2c-abi g95-abi gfortran-abi intel-unix-abi intel-windows-abi ;

TUPLE: bad-fortran-abi detail ;
C: <bad-fortran-abi> bad-fortran-abi

: alien>nstring ( alien len encoding -- string )
    [ memory>byte-array ] dip decode ;
