- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello IanH,
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.
Greetings Sebastian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sebastian K. wrote:
Hello IanH,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page