Access a parameter from an interface (Fortran)

后端 未结 1 1486
傲寒
傲寒 2020-12-11 07:15

I am using a parameter to fix the precision of the used types. This works fine until I try to use the same type within an interface. Consider this small example:

相关标签:
1条回答
  • 2020-12-11 07:59

    The easiest way is to add import inside the interface. It is somewhat of a misdesign that the definitions of the module are outside the scope of the interface. Plain import will import everything.

    ....
        subroutine dosomething(fun)
            real(K)     :: foo
            interface
               function fun(bar)
                    import
                    real(K) :: bar
                    real(K) :: fun
               end function fun
            end interface
        end subroutine
    ....
    

    Also possible: import :: K

    0 讨论(0)
提交回复
热议问题