A subprogram is said to be external when it is not contained in the main program, nor in a module or antoher subprogram. In particular it can be defined by means of a programming language other than Fortran.
When an external subprogram is invoked, the compiler cannot access to its code, so all the information allowable to the compiler is implicitly contained in the calling statement of the calling program and in the type an properties of the acutal arguments, not the dummy arguments (whose declaration is unknown to the compiler). In this case we say that the interface is implicit.
An external
statement can be used to specify that a procedure's name is relative to an external procedure,
external external_name_list
but even so, the interface remain implicit.
An interface
block can be used to specify the interface of an external procedure,
interface
interface_body
end interface
where the interface_body
is normally an exact copy of the procedure header followed by the declaration of all its arguments and, if it is a function, of the result.
For example, for function WindSpeed
real function WindSpeed(u, v)
real, intent(in) :: u, v
WindSpeed = sqrt(u*u + v*v)
end function WindSpeed
You can write the following interface
interface
real function WindSpeed(u, v)
real, intent(in) :: u, v
end function WindSpeed
end interface