LF Fortran 95

EXTERNAL Statement


The EXTERNAL statement declares external procedures. Specifying a procedure name as EXTERNAL permits the procedure name to be used as an actual argument.


EXTERNAL [::] external-name-list

external-name-list is a comma-separated list of

external procedures, dummy procedures, or block data program units


If an intrinsic procedure name appears in an EXTERNAL statement, the intrinsic procedure is not available in the scoping unit and the name is that of an external procedure.

A name can appear only once in all of the EXTERNAL statements in a scoping unit.

If the external procedure is a block data subprogram, the inclusion of the block data in the program is required.


program main external sub1 ! external statement integer,external :: fun1 ! external attribute call bill(sub1,fun1) end program subroutine bill(proc,fun) integer :: fun,i i=fun() call proc(i) end subroutine subroutine sub1(i) integer :: i write(*,*) i end subroutine function fun1() integer :: fun1 fun1=1 end function