1

Is it possible to document Fortran interface via Doxygen? My extensive search has led me to believe that it is possible. But there does not seem to exist any clues on the web as to how this is possible. As an example consider the following interface that lives in a module:

module test_mod

    !> \brief
    !> Return the factorial for a whole integer input. This is basically `Gamma( intNum + 1 )`.
    !>
    !> \param[in]   positiveInteger :   The input positive integer whose factorial must be computed.
    !>
    !> \return
    !> `factorial`  :   The factorial.
    interface
        pure function getFactorial(positiveInteger) result(factorial)
            use iso_fortran_env, only: IK => int32, RK => real64
            implicit none
            integer(IK), intent(in) :: positiveInteger
            real(RK)                :: factorial
        end function getFactorial
    end interface

end module test_mod

But such a documentation does not seem to work. Your help is very much appreciated.

Scientist
  • 1,767
  • 2
  • 12
  • 20
  • 2
    Could you explain what you mean by "does not seem to work"? It's definitely possible and I've done it in the past, but over the last few years I've used [FORD](https://politicalphysicist.github.io/ford-fortran-documentation.html) instead as back then Doxygen support for Fortran was rather poor - though it is my understanding it has improved. – Ian Bush Aug 29 '21 at 08:08
  • 2
    Doxygen is lagging a "bit" in respect to the more modern Fortran features. In the above case doxygen doesn't like the fact that the documentation is with the interface, it should be with the implementation of the function (it would be nice when it would have worked straight away inside the interface (outside the interface doxygen thinks it is the documentation of the interface, which in this case should result in correct documentation as well but with named interfaces....)). Best is to document it with the implementation. Btw. Which version of doxygen – albert Aug 29 '21 at 08:45
  • Okay, Thanks for your hints @albert. I did a few more tests, and as you hinted, the interface must be named (although that is contrary to what is claimed in the Doxygen patch that I posted in my question). The ultimate goal is to be able to write one documentation for a generic interface that contains several templated procedures. Luckily, it turns out that Intel and Gfortran compilers accept named submodule interfaces. So, the implementation can go inside the submodule, while the procedure interfaces can live under a common generic interface name in the module, with one documentation. – Scientist Aug 29 '21 at 23:38

0 Answers0