我有一个示例代码测试我用Fortran 90超载子程序理解这是我的例子:Fortran的未解决的模块程序规范名称
module testint_mod
use constants
implicit none
private :: testvReal
private :: testvdpn
interface testv
module procedure testvReal
module procedure testvdpn
end interface
contains
subroutine testvReal(vR)
implicit none
real,intent(in) :: vR
write(*,*) vR
end subroutine
subroutine testvdpn(vdpn)
implicit none
real(kind=dpn),intent(in) :: vdpn
write(*,*) vdpn
end subroutine
end module testint_mod
program testintmain
use constants
use testint_mod
implicit none
real :: r
real(kind=dpn) :: d
integer :: i
interface testv
module procedure testvdpn
end interface
r = 2.0
d = dble(4.0)
call testv(r)
call testv(d)
end program testintmain
其中常量包括:整数,参数DPN = selected_real_kind(14)
我得到的错误:
testint_main.F(10) : Error: Unresolved MODULE PROCEDURE specification name. [T
ESTVDPN]
module procedure testvdpn
-------------------------^
我在做什么错?是否不允许使用selected_real_kind()重载函数?我感谢任何帮助!
啊,当然,我忘了通过使用声明的访问。现在好像工作正常,谢谢! – Charlie
不,函数结果的类型在通用分辨率中不起作用!只有论据是重要的。 –
@VladimirF上下文应该是结果没有考虑,但我希望澄清,现在的答案。 – francescalus