This is interesting. Is it working with recursion?
Example:
module other
integer, parameter :: CONST_N = 10
contains
subroutine foo(fptr)
integer :: fptr
print *, fptr()
end subroutine foo
end module other
recursive subroutine host(local)
use other
integer, value :: local
call foo(callee)
return
contains
function callee()
integer :: callee
callee = local
if (local .le. CONST_N) then
call host(local + 1)
endif
end function callee
end subroutine host