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

Case Problem with !DEC$ ATTRIBUTES ALIAS

knasterbax
Beginner
876 Views
I'm trying to export a Fortran function into a LIB, which is later to be used from C/C++ and I'm experiencing a Upper/Mixed-Case Problem with the ALIAS directive:

Here are the relevant lines of code:

integer*4 function GetSolutionStatus ()
!DEC$ ATTRIBUTES C, ALIAS:'_GetSolutionStatus' :: GetSolutionStatus
....

The function will be compiled into the the LIB with the name "_GETSOLUTIONSTATUS" - all UPPERCASE, and not MixedCase, as I wanted it.

If you shorten the name to 14 chararcters including the leading underscore by

!DEC$ ATTRIBUTES C, ALIAS:'_GetSolutionSt' :: GetSolutionStatus

it will be compiled correctly to mixed case. If I quit the C-directive, I can expand the name to 17 characters "_GetSolutionStatu" which exports correctly to mixed-case

!DEC$ ATTRIBUTES ALIAS:'_GetSolutionStatu' :: GetSolutionStatus

But anything with more than 16 characters without the underscore is allways UPPERCASE. Obviously there is a limit around the "magic" number 16. Bug or feature?

I'm using Intel Fortran v8.1.2279.2003
BTW: Compaq Fortran 6 does the same
0 Kudos
4 Replies
Steven_L_Intel1
Employee
876 Views
By any chance does your source file name end with .f or .for?
0 Kudos
knasterbax
Beginner
876 Views
it ends with ".for"
0 Kudos
Steven_L_Intel1
Employee
876 Views

Thought so. Your directive extends past column 72 with the longer name and thus does not have the desired effect. Split it into two or more directives.

My advice is to use free-form source (.f90 file type) for all new coding. It will avoid problems such as this one and many others.

If you must use fixed-form source, enable the option to warn of truncated source lines.

0 Kudos
knasterbax
Beginner
876 Views
You were right!!!

Since the compiler directives are colored green, one does not see the also green coloring that happens to the text beyond column 72 as a warning.

Thanks for the swift reply! Good customer service.
0 Kudos
Reply