You copied the Doc URL to your clipboard.

Complex

Fortran functions that return a COMPLEX data type cannot be directly called from C or C++. Instead, a workaround is possible by passing a C or C++ function a pointer to a memory area. This memory area can then be calling the COMPLEX function and storing the returned value.

For example, the Fortran function:

SUBROUTINE INTER_CF(C, I)
  COMPLEX C
  COMPLEX CF
  C = CF(I)
  RETURN
END

COMPLEX FUNCTION CF(I)
  . . .
END

when called in C/C++ is completed using a memory pointer:

extern void inter_cf_();
    typedef struct {float real, imag;} cplx;
    cplx c1;
    int i;
    inter_cf_( &c1, &i);
Was this page helpful? Yes No