MIXED_STR_LEN_ARG with gfortran

122 Views Asked by At

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?

1

There are 1 best solutions below

2
Vladimir F Героям слава On

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.