The rules of sequence association allow similar situation. You can use
call my_sub('Hello World!')
but only if you make your array assumed size dimension(*)
or explicit shape.
Generally, in Fortran 2008 you cannot use assumed shape arrays for C-interoperable procedures. This will change i the future, but will be more complicated.
One other important remark. Just using iso_c_binding
module doesn't make the procedure C-interoperable. You have to use bind(C)
, possibly with binding name. That's the important thing. You can create interoperable procedures even without the module (only limited ones). The feature of passing the string instead of 1-character array also depends on this.
This is why i don't like saying "use iso_c_binding to create interoperable procedures".
The interface to the procedure will have to explicit in Fortran.