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

Warning #8889 Explicit declaration of the external attribute is required

Dix_Carneiro__Rafael
5,972 Views

Hello,

I have just updated my FORTRAN compiler and am getting the warning above when I call MKL subroutines. I am including the MKL library automatically using the project properties tab. 

I searched online and am unable to find how I can fix this?

Many thanks for the help,
Rafael

0 Kudos
5 Replies
andrew_4619
Honored Contributor II
5,961 Views
You need use mkl in the source to show the interface for the routine.
0 Kudos
Dix_Carneiro__Rafael
5,955 Views

Hi, thanks.

Do you mean just place:

include 'mkl.fi' 

in the code?

If so, it is taking **much longer** to compile now... Any idea / reason why these warnings are popping up now? The code runs fine even with these warnings (as it did before I updated the Fortran compiler).

Also, I found a few instances of getting errors once I did " include 'mkl.fi' " like this one:
error #8284: If the actual argument is scalar, the dummy argument shall be scalar unless the actual argument is of type character or is an element of an array that is not assumed shape, pointer, or polymorphic

Again, to clarify, this code has been running fine, without any of these errors or warnings until today, when

Many thanks,
Rafael

0 Kudos
mecej4
Honored Contributor III
5,948 Views

Instead of adding include 'mkl.fi' to your source code, which causes compilation time to increase, you can build a module that provides the interfaces. Do the following steps once, for each target architecture.

  • Create a fixed form Fortran source file containing the lines 
    c
          module mkl_m      
          include 'mkl.fi'
          end module​
  • Compile the file, and place the resulting .mod file in ...\mkl\include\ia32 directory, if building for IA32 (and correspondingly for LP64 and ILP64).
  • In your Fortran source files that make MKL calls, instead of include 'mkl.fi' add use mkl_m .

Regarding the warnings regarding passing a scalar when an array is expected, which result from the recent releases of the compiler doing more checking, you may ignore the warning if the code is working correctly, or change the declaration of the offending argument to make it an array. This problem usually arises when passing a place-holder argument that we know will never be referenced in the called MKL routine. Instead of 

real dummy
...
call mkl_routine(...,dummy,...)

write

real dummy(1)
...
call mkl_routine(...,dummy,...)
0 Kudos
Steve_Lionel
Honored Contributor III
5,904 Views

My guess is that you are compiling from the command line and using /warn (or -warn) with no keywords. There's a new feature of Fortran 2018 called IMPLICIT NONE (EXTERNAL), which, if you specify it, requires that any procedure you call have the EXTERNAL attribute, which you typically get from an explicit interface. 

Similarly to how "/warn:declarations" implies IMPLICIT NONE for all compilations, the new "/warn:external" implies IMPLICIT NONE (EXTERNAL). If you want to disable this, change your /warn option either to specify just the options you want, or use "/warn:all,noexternal" or "-warn all,noexternal"

Reply