Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26745 Discussions

!DEC ATTRIBUTES directive and case sensitivity

avinashs
New Contributor I
135 Views

When the case of the subroutine name does not match the case in an alias statement, the corresponding function is not exported. Is this an expected result? If so, this is one instance of case sensitivity in Fortran that I was unaware of although strictly speaking it is a compiler directive. An example is included below.

SUBROUTINE MYSUB(A,B,C)
  !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS : 'mysub' :: mysub
  INTEGER A,B,C
  !
  ! mysub is not exported when there is a case mismatch: MYSUB vs mysub
  !
END SUBROUTINE MYSUB

SUBROUTINE MYSUB(A,B,C)
  !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS : 'MYSUB' :: MYSUB
  INTEGER A,B,C
  !
  ! MYSUB is correctly exported when upper case is used in the attributes statement
  !
END SUBROUTINE MYSUB

 

0 Kudos
2 Replies
mecej4
Black Belt
135 Views

The symbols are certainly exported, but the DLL that gets built has certain limitations. Those symbols that do not follow the compiler's default external symbol naming conventions cannot be linked to unless further directives are provided to the calling subroutine.

I built a DLL using the following code

SUBROUTINE MYSUB1(A,B,C)
  !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS : 'mysub1' :: mysub1
  INTEGER A,B,C
  !
  !
END SUBROUTINE MYSUB1

SUBROUTINE MYSUB2(A,B,C)
  !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS : 'MYSUB2' :: MYSUB2
  INTEGER A,B,C
  !
  ! MYSUB is correctly exported when upper case is used in the attributes statement
  !
END SUBROUTINE MYSUB2

and I see the following exported symbols.

    ordinal hint RVA      name

          1    0 00001010 MYSUB2
          2    1 00001000 mysub1

All this is outside the Fortran standard, so it is not "an instance of case sensitivity in Fortran".

avinashs
New Contributor I
135 Views

Thanks @mecej4. In my case, for whatever reason, I am not seeing all the functions being exported. However, easy enough to stick to the correct case.

Reply