If a Fortran program expects a procedure to return a complex or double-complex value, the Fortran compiler adds an additional argument to the beginning of the called procedure argument list. This additional argument is a pointer to the location where the called procedure must store its result.
Example below shows the Fortran code for returning a complex data type procedure called wbat and the corresponding C routine.
Fortran code |
Corresponding C Routine |
In the above example, the following restrictions and behaviors apply:
The argument location does not appear in the Fortran call; it is added by the compiler.
The C subroutine must copy the result's real and imaginary parts correctly into location.
The called procedure is type void.
If the function returned a double complex value, the type float would be replaced by the type double in the definition of location in wbat.