A subprogram (which defines a procedure), can be either a subroutine or a function; it is said to be an internal subprogram if it is called or invoked from the same program or subprogram that contains it, as follows
program my_program
! declarations
! executable statements,
! among which an invocation to
! internal procedure(s),
call my_sub(arg1,arg2,...)
fx = my_fun(xx1,xx2,...)
contains
subroutine my_sub(a1,a2,...)
! declarations
! executable statements
end subroutine my_sub
function my_fun(x1,x2,...) result(f)
! declarations
! executable statements
end function my_fun
end program my_program
In this case the compiler will know all about any internal procedure, since it treats the program unit as a whole. In particular, it will "see" the procedure's interface, that is
function or subroutine,a1, a2, x1, x2, ...,f (in the case of a function).Being the interface known, the compiler can check whether the actual arguments (arg1, arg2, xx1, xx2, fx, ...) passed to the procedure match with the dummy arguments (a1, a2, x1, x2, f, ...).
In this case we say that the interface is explicit.
A subprogram is said to be module subprogram when it is invoked by a statement in the containing module itself,
module my_mod
! declarations
contains
subroutine my_mod_sub(b1,b2,...)
! declarations
! executable statements
r = my_mod_fun(b1,b2,...)
end subroutine my_sub
function my_mod_fun(y1,y2,...) result(g)
! declarations
! executable statements
end function my_fun
end module my_mod
or by a statement in another program unit that uses that module,
program my_prog
use my_mod
call my_mod_sub(...)
end program my_prog
As in the preceding situation, the compiler will know everything about the subprogram and, therefore, we say that the interface is explicit.