Do I need to define an interface for recursive Fortran95 (and above) subroutines? In a library, does it make a difference if the subroutine is exported to the user?
Asked
Active
Viewed 174 times
0
-
What do you mean by "define an interface". Do you mean, "must there be an explicit interface when such a procedure is referenced?"? – francescalus Jun 13 '16 at 09:28
-
Yes, that's what I meant. – fpnick Jun 13 '16 at 09:41
-
1You should always provide an explicit interface (best using a module, NOT an interface block!) so that the user does not have to do it himself, but IIRC it is not strictly necessary here. – Vladimir F Героям слава Jun 13 '16 at 09:55
-
I have copied the things which require an explicit interface on reference in [a previous answer](https://stackoverflow.com/a/31630662). As you can see, `recursive` is not there. But it's still a good idea to offer one. – francescalus Jun 13 '16 at 10:09
-
Thanks francescalus, that's about what we needed. – fpnick Jun 13 '16 at 14:51
1 Answers
2
RECURSIVE is not an attribute that requires an explicit interface, as it doesn't affect how the procedure is called. For more information on explicit interfaces, see an article I wrote a while back on the topic: https://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again

Steve Lionel
- 6,972
- 18
- 31