Community
cancel
Showing results for 
Search instead for 
Did you mean: 
1,397 Views

Warning #8889 Explicit declaration of the external attribute is required

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 I
1,386 Views

You need use mkl in the source to show the interface for the routine.
1,380 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

mecej4
Black Belt
1,373 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,...)
FortranFan
Honored Contributor I
1,358 Views

@Dix_Carneiro__Rafael ,

Have you looked at Intel MKL documentation, specifically the section on Interfaces and Libraries:

https://software.intel.com/content/www/us/en/develop/documentation/mkl-windows-developer-guide/top/l...

Steve_Lionel
Black Belt Retired Employee
1,329 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