[Fortran] 纯文本查看 复制代码
program main
CALL B()
CALL FKB(B)
contains
subroutine B()
IMPLICIT NONE
write (*,*) 'fk'
end subroutine B
subroutine FKB(fcn)
implicit none
INTERFACE
SUBROUTINE fcn()
IMPLICIT NONE
END SUBROUTINE fcn
END INTERFACE
write (*,*) '1'
call B()
write (*,*) '2'
call fcn()
write (*,*) '3'
end subroutine FKB
end
[Fortran] 纯文本查看 复制代码
Module fcnMod
Interface
Subroutine IF_fcn()
End Subroutine IF_fcn
End Interface
contains
subroutine B()
write (*,*) 'fk'
end subroutine B
End Module fcnMod
program main
use fcnMod
IMPLICIT NONE
CALL B()
CALL FKB(B)
contains
subroutine FKB(fcn)
Procedure(IF_fcn) :: fcn
write (*,*) '1'
call B()
write (*,*) '2'
call fcn()
write (*,*) '3'
end subroutine FKB
end
[Fortran] 纯文本查看 复制代码
Subroutine C()
write (*,*) 'fc'
End Subroutine C
program main
IMPLICIT NONE
Interface
Subroutine IF_fcn()
End Subroutine IF_fcn
End Interface
Procedure(IF_fcn) :: C
CALL C()
CALL FKB(C)
contains
subroutine FKB(fcn)
Procedure(IF_fcn) :: fcn
write (*,*) '1'
call C()
write (*,*) '2'
call fcn()
write (*,*) '3'
end subroutine FKB
end