Success!
[u:1a418c3b2b]Standard extension[/u:1a418c3b2b]
The code below works with the IMPORT statement and /F2K enabled in Version 7.10 😃
[u:1a418c3b2b]Non standard extension[/u:1a418c3b2b]
Note that as a non-standard extension you can still omit the import and parameter declaration lines and it does host association (i.e. it seems to import whatever it needs from the host to maintain linkage). It would have been nice to have a NON_STANDARD warning in such cases that could be switched off with /NON_STANDARD but I am happy with it as it is.
Note that using /ISO doesn't seem to produce the error message for this non-standard extension as indicated in the release notes.
David.
module mod
integer, parameter :: dp = kind(1.0d0)
contains
subroutine test(fnc, x, y)
! Interface defining fnc dummay argument
interface
function fnc(x)
! F2000 extension needs /F2K
import dp
! F95 needs to redeclare dp as it isn't accessible by 'host' association
! integer, parameter :: dp = kind(1.0d0)
real(kind=dp), intent(in) :: x
real(kind=dp) :: fnc
end function fnc
end interface
real(kind=dp), intent(in) :: x
real(kind=dp), intent(out) :: y
y = fnc(x)
end subroutine test
function fnc(x)
real(kind=dp), intent(in) :: x
real(kind=dp) :: fnc
fnc = x
end function fnc
end module mod
program anon
use mod
real(kind=dp) :: y
call test(fnc, 1.0d0, y)
print *, y, '<-- should print 1.0 and is!'
end program anon