Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Reply to Dr. Steve and Jim


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:

module mydefine
use iso_c_binding
! C++ interface
end interface

! some Fortran functions such as 'writeerrormsg'
end module 

Do you have any suggestion?


Tang Laoya


0 Kudos
1 Reply
Black Belt

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.

0 Kudos