- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
...
interface
! C++ interface
...
end interface
contains
! some Fortran functions such as 'writeerrormsg'
...
end module
Do you have any suggestion?
Thanks,
Tang Laoya
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page