- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the help files to use a keyword argument one needs an interface. This is annoying enough since he interface is right there on top of the procedure. But if the procedure is inside a module then cvf 6.6b still gives an error:
"The name of the module procedure conflicts with a name in the encompassing scoping unit."
here is the interface
interface
subroutine HHT_createTable(table_Name,TimeSeries)
character(*),intent(in):: table_Name
logical,intent(in),optional:: TimeSeries
end subroutine HHT_createTable
end interface
First I assume this interface has to be in the module not the caller program.
Second, where is name conflict, when the routine in the interface and the real one are identical
are these names case sensitive or decorated or...?
Seems I'm missing something obvious.
Thanks in advance.
Tim
"The name of the module procedure conflicts with a name in the encompassing scoping unit."
here is the interface
interface
subroutine HHT_createTable(table_Name,TimeSeries)
character(*),intent(in):: table_Name
logical,intent(in),optional:: TimeSeries
end subroutine HHT_createTable
end interface
First I assume this interface has to be in the module not the caller program.
Second, where is name conflict, when the routine in the interface and the real one are identical
are these names case sensitive or decorated or...?
Seems I'm missing something obvious.
Thanks in advance.
Tim
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You don't show an entire source, so I'm not sure what you've done.
If you are using a module procedure, you don't use an INTERFACE block. The module procedure is its own explicit interface. If you have both, that's probably why you get the error.
See my article on the topic for more details.
Steve
If you are using a module procedure, you don't use an INTERFACE block. The module procedure is its own explicit interface. If you have both, that's probably why you get the error.
See my article on the topic for more details.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a QD version.
I can't even get this one to acknowledge the interface, much less the error I posted before.
It might be that before I had the module in a different file which is the way I have to do things.
Can you see the problem(s) this?
use m
real(4):: y2=1
call x(y2,z=4.)
end
module m
interface
subroutine x(y,z)
real(4),intent(in):: y
real(4),intent(in),optional:: z
end subroutine x
end interface
contains
subroutine x(y,z)
real(4),intent(in):: y
real(4),intent(in),optional:: z
if(present(z))write(*,*)z,y
pause
end subroutine x
end module m
I can't even get this one to acknowledge the interface, much less the error I posted before.
It might be that before I had the module in a different file which is the way I have to do things.
Can you see the problem(s) this?
use m
real(4):: y2=1
call x(y2,z=4.)
end
module m
interface
subroutine x(y,z)
real(4),intent(in):: y
real(4),intent(in),optional:: z
end subroutine x
end interface
contains
subroutine x(y,z)
real(4),intent(in):: y
real(4),intent(in),optional:: z
if(present(z))write(*,*)z,y
pause
end subroutine x
end module m
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Get rid of the INTERFACE block in the module. As I said above, a module procedure is its own explicit interface. You don't need it twice (and in fact CAN'T).
2. You can't compile the main program until after the module has been compiled.
Steve
2. You can't compile the main program until after the module has been compiled.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The way I have it is to keep the module in a separate file. I compile the mod file first. If there is no interface (which is fine by me), then I end up back where I started
Error: Keyword arguments are invalid without an explicit interface.
Is this simply not possible then?
Tim
Error: Keyword arguments are invalid without an explicit interface.
Is this simply not possible then?
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After some unrelated fooling around, I set up the calls the way they were, (no interface block), and now I no longer get the interface-required error.
I don't know what I had done to get the error in the first place.
Sorry!
I don't know what I had done to get the error in the first place.
Sorry!

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