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

ifort

mike4239
Novice
1,185 Views

Why the following option for ifort compiler does not add double under scores to the compiled function? 

   /assume:2underscore

 

 

 

10 Replies
Ron_Green
Moderator
1,166 Views

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 myprogrammy_program becomes my_program__, but myprogram becomes myprogram_."

 

what is the original name of the procedure or data?

0 Kudos
mike4239
Novice
1,136 Views

Thanks for your reply. Yes, the function name does contain a underscore.

0 Kudos
Barbara_P_Intel
Moderator
1,165 Views

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 "/".

mike4239
Novice
1,132 Views

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?  

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,127 Views

Use ATTRIBUTES ALIAS (intel.com)

Jim Dempsey

 

andrew_4619
Honored Contributor II
1,108 Views

r maybe this one:

!DIR$ ATTRIBUTES DECORATE :: exname

Steve_Lionel
Honored Contributor III
1,086 Views

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.

0 Kudos
mike4239
Novice
989 Views

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.

0 Kudos
andrew_4619
Honored Contributor II
1,042 Views

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....... 

0 Kudos
Steve_Lionel
Honored Contributor III
1,009 Views

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.)

0 Kudos
Reply