The word function has different meanings in C and Fortran. Depending on the situation, the choice is important:
In C, all subprograms are functions; however, void functions do not return a value.
In Fortran, a function passes a return value, but a subroutine generally does not.
When a Fortran routine calls a C function:
If the called C function returns a value, call it from Fortran as a function.
If the called C function does not return a value, call it as a subroutine.
When a C function calls a Fortran subprogram:
If the called Fortran subprogram is a function, call it from C as a function that returns a compatible data type.
If the called Fortran subprogram is a subroutine, call it from C as a function that returns a value of int (compatible to Fortran INTEGER*4) or void otherwise. A value is returned if the Fortran subroutine uses alternate returns, in which case it is the value of the expression on the RETURN statement. If no expression appears on the RETURN statement, and alternate returns are declared on the SUBROUTINE statement, a zero is returned.