Dear Dr. Steve and Jim,
Thank you very much for your kindly reply. I don't know why I can't click 'Reply' button in the original topic so I post a new one.
To Dr. Steve:
The 'writestring' is a C++ function. You said that the Fortran code is incorrect, but it works when I used Intel Fortran 2020. I understand that the new standard is stricter, however, I wish the compiler would have the option to compatibility old standard, even the old Fortran 77 standard.
To Dr. Jim,
I have already added 'use iso_c_binding' in my code. I added this line as follows:
! C++ interface
! some Fortran functions such as 'writeerrormsg'
Do you have any suggestion?
It's not that "the new standard is stricter", but that the new compiler detects an error that the old one did not. That happens a lot. Your code was invalid in F2003 (which was even stricter than the later standards), F2008 and F2018. C_LOC did not exist prior to F2003.
What is your Fortran interface for writestring, if you even have one?
You might try as an experiment replacing C_LOC() with LOC(). This is an extension that is more forgiving as to its argument and should pass the same value to the C++ routine.