Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what's wrong with this subroutine?

Status
Not open for further replies.

cdr74

Technical User
Nov 11, 2007
1
ES
Hi everyone!

I'm just trying to remember my fortran programming skills, but it's looking a little bit hard.

I've tried this simple code in the Visual Studio (Intel Visual Fortran 10 compiler), and it gives me a bunch of errors:
INTERFACE
Subroutine load_P(P,N)
real :: P:),:)
integer, INTENT(IN) :: N
End subroutine
END INTERFACE

integer :: N
real, allocatable :: P:),:)

N = 20
call load_P(P,N)

END PROGRAM

SUBROUTINE load_P(P,N)
real, allocatable :: P:),:)
integer N
END SUBROUTINE

->>>
Error: There is a conflict between local interface block and external interface block. [LOAD_P]
Error: The number of actual arguments cannot be greater than the number of dummy arguments. [LOAD_P]
Error: The type of the actual argument differs from the type of the dummy argument. [P]
Error: The shape matching rules of actual arguments and dummy arguments have been violated. [P]

Thanks for your help!!
 
Your interface should be the same as your declaration
Code:
INTERFACE 
Subroutine load_P(P,N)
real[COLOR=red], allocatable, intent(INOUT)[/color] :: P(:,:)
integer, INTENT(IN) :: N
End subroutine
END INTERFACE
...
SUBROUTINE load_P(P,N)
real, allocatable[COLOR=red], intent(INOUT)[/color] :: P(:,:)
integer[COLOR=red], INTENT(IN)::[/color] N
END SUBROUTINE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top