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)
integer (intd) FUNCTION test(name)
character (len=*) name
end function test
Then, within file xxx.f the function test is called via:
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]
I'm only able to fix the problem by defining within xxx.f an extra interface block for the function test like the following:
character (len=*), intent(in):: name
end function test
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?
The compiler is complaining about the name 'test', not 'intd'.
Do you have a USE statement for the module in the scope where the function is referenced? Is the function 'test' a public entity of the module?
fur sure(!), a USE statement is contained in xxx.f. All other public symbols and (function/subroutine) definitions are correctly exported from the module! !!! Only the type intd is not exported and that's what the compiler is complaining about. I am trying to compile a foreign, closed source code, so I am not allowed to paste the original code.
You should be able to construct a minimal but self-contained example that demonstrates the problem, without revealing any of the private code. My guess is that in the process of doing so you'll figure out what the problem is, but if not post the example and compiling results here.
Sebastian K. wrote:
fur sure(!), a USE statement is contained in xxx.f. All other public symbols and (function/subroutine) definitions are correctly exported from the module! !!! Only the type intd is not exported and that's what the compiler is complaining about.
The code you posted shows 'intd' as a public entity of the module.
Hey guy, thanks very much for your replies.
I was able to detect/resolve the problem:
Unfortunately, a (precompiler) macro definition was missing from the arguments passed to the compiler, so that a relevant part of the code within an #ifdef was not built into the library. An aged version of a template file with missing compiler options/switches was automatically chosen during configuration of the makefile system.