Topic: Passing strings from Fortran to other languages
Regarding the interoperability of Fortran with C and other languages, it seems that even Fortran 2018 has not worked out all the bugs regarding sending a string from one language to a Fortran DLL, and then sending it from Fortran back to the calling language.
I have not put a lot of thought into it and have not tried this (yet), but why not simply convert the characters in a string into their ASCII (or other base) equivalents, and then send between C/C#/VB.NET/et al and Fortran as a 1D integer array?
For example, instead of trying to send "This is a string" between the two languages, why not send
(84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 115, 116, 114, 105, 110, 103)
back and forth (of course using the appropriate routines in C (or other language) and Fortran to do the character to integer conversions, parsing of the string into ASCII, connotation of characters, etc.)? I am sure I am not the first one to think of this, but it seems a lot easier to embed the code to do the ASCII conversions in the two programs than to jump through hoops via iso C binding for strings.
Thoughts? Could it be that simple?