procedure argument
- From: Roland Schmehl <rschmehl@xxxxxxxxx>
- Date: Thu, 30 Mar 2006 18:40:29 +0200
a question regarding the usage of procedure arguments with different
argument lists.
the appended code compiles and writes out:
sub1: a= 1.0
sub2: a= 1.0 , b= 2.0
when i replace the two "EXTERNAL sub" statements by interface blocks
INTERFACE
SUBROUTINE sub (a,b)
REAL :: a,b
END SUBROUTINE sub
END INTERFACE
the compiler complains (as it should) about the different number of arguments of actual and dummy procedure.
why does it accept the EXTERNAL statements?
thanks,
roland
MODULE testmod
INTERFACE
SUBROUTINE sub1 (a)
REAL :: a
END SUBROUTINE sub1
END INTERFACE
INTERFACE
SUBROUTINE sub2 (a,b)
REAL :: a,b
END SUBROUTINE sub2
END INTERFACE
INTERFACE
SUBROUTINE process (sub)
EXTERNAL sub
REAL :: c=1.0,d=2.0
END SUBROUTINE process
END INTERFACE
END MODULE testmod
PROGRAM testprog
USE testmod, ONLY: sub1,sub2,process
CALL process (sub1)
CALL process (sub2)
END PROGRAM testprog
SUBROUTINE process (sub)
EXTERNAL sub
REAL :: c=1.0,d=2.0
CALL sub (c,d)
END SUBROUTINE process
SUBROUTINE sub1 (a)
REAL :: a
WRITE(*,*)'sub1: a= ',a
END SUBROUTINE sub1
SUBROUTINE sub2 (a,b)
REAL :: a,b
WRITE(*,*)'sub2: a= ',a,', b= ',b
END SUBROUTINE sub2
.
- Follow-Ups:
- Re: procedure argument
- From: Richard E Maine
- Re: procedure argument
- From: Joe Krahn
- Re: procedure argument
- Prev by Date: Re: .mod generation question
- Next by Date: Help: IFC stack overflow
- Previous by thread: Making fortran libraries
- Next by thread: Re: procedure argument
- Index(es):
Relevant Pages
|
|