- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why the following option for ifort compiler does not add double under scores to the compiled function?
/assume:2underscore
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do not forget the documentation on 2underscores requires the name to have at least 1 underscore in the name.
"This option does not affect external names that do not contain an embedded underscore. By default, the compiler only appends one underscore to those names. For example, if you specify assume 2underscores for external names my_program and myprogram, my_program becomes my_program__, but myprogram becomes myprogram_."
what is the original name of the procedure or data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply. Yes, the function name does contain a underscore.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the DGR (Developer Guide and Reference), -assume:2underscore is only available for Linux and macOS. Looks like you are trying it on Windows; I see the "/".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. Yes, I am using ifort on a Windows. I didn't know that this keyword is not applicable on Windows platform. Does that mean there is no way to add double underscores to function name on Windows?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
r maybe this one:
!DIR$ ATTRIBUTES DECORATE :: exname
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, DECORATE won't do this.
My question to @mike4239 is - why do you think you need to use this? The two-underscore thing was a quirk of the long-obsolete g77 compiler on Linux/UNIX systems. I can't imagine a circumstance where this would be useful on Windows.
That said if there is some non-Fortran routine you are trying to call and it somehow chooses to add two underscores to its name, you can specify any name you want with !DIR$ ATTRIBUTES ALIAS, or even the Fortran standard's C interoperabilty features.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, we do have some very old f77/g77 code. And, the code calls C functions (with underscore in their names). The same codes are on Linux and Windows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assumed (incorrectly it appears) that the only reason the underscores were being requested was to match the DECORATION of a calling convention. It appears from Steve's post that the request seems to match no known calling convention on Windows.......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right. The decoration conventions on 32-bit Windows are to prefix a global name with one underscore, and if the procedure uses the STDCALL calling mechanism, to append @n where n is the number of bytes pushed on the stack. 64-bit Windows uses neither of these. The DECORATE attribute is there so that you can have one ALIAS name and have the compiler apply the appropriate decoration based on 32/64 bit and STDCALL/C.
On UNIX and derivative systems, there is an informal convention that Fortran procedure global names have one underscore at the end. g77 did something weird and added two underscores if the name contained an underscore; modern Fortran compilers on UNIX/Linux systems don't do the two-underscore thig (but do use one trailing underscore for Fortran.)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page