0

I have a program in mixed C++/Fortran, in which a C++ character is given as argument for a Fortran function.

The code is compiling and working with ifort compiler, using the option -mixed_str_len_arg, which specifies the position of the hidden length for character arguments (see https://software.intel.com/en-us/node/525960).

For some reason, I want to compile the code using gfortran, but did not find any equivalent option with this compiler. Are you aware of a similar option, or an other alternative?

R. Gx
  • 1
  • 1

1 Answers1

1

There is no such flag available. The calling conventions are fixed and exactly specified in the manual https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html

If you interact between C(++) and Fortran. it is better to use modern interoperability features. Fortran bind(C) procedures do not have any hidden arguments and you can define the function exactly as you need it.

  • I suspect that a close search of SO will turn up a Q and A to guide OP in implementing this interaction. Not something I have time for right now. – High Performance Mark Jul 15 '16 at 11:01
  • Thanks for your reply Vladimir F, I wanted to avoid modifying the (old) fortran code, and therefore use the bind(C) procedure. But it looks like there is no turnaround. – R. Gx Jul 15 '16 at 11:13