Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

declared variable type not exported from Fortran module

$
0
0

I am trying to compile a Fortran code including a specific module with the following type declaration and function definition:

integer, parameter, public :: intd = selected_int_kind(17)
...
contains
...
integer (intd) FUNCTION test(name)
implicit none
character (len=*) name
integer(intd),public:: test
...
return
end function test

Then, within file xxx.f the function test is called via:

number=test(input)

While compiling the file xxx.f, the compiler (ifort 16.0.2.XXX) complains, that the type intd didn't get export:

xxx.f(67): error #6404: This name does not have a type, and must have an explicit type. [TEST]
number=test(input)

I'm only able to fix the problem by defining within xxx.f an extra interface block for the function test like the following:

interface
function test(name)
import:: intd
character (len=*), intent(in):: name
integer(int8):: test
end function test
end interface

Is there any limitation within the design of the Fortran module interfaces disallowing the exportation of the declared type intd or is something wrong about the given code?

Greetings

Sebastian

Thread Topic: 

Help Me

Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>