i want to pass variable array size to subroutine. the following will illustrate
integer*1 i,is ,j,j1,j2,m1,m2,np,npmx,nps
integer*1,allocatable::ilisin),ils)
common nps,npmx,np
npmx=2;nps=3
allocate(ilisin(nps),ils(2*nps-min(3,nps)))
call wigd(1,ilisin,0,ils)
end
subroutine wigd(ii,ilisin,imn,ils);integer*1 i,ii,imn,np,nps
integer*1,allocatable::ilisin),ils);common nps,np
print*,"nps",nps
end
NOw it gives error as says interface required. So i read all about this ' interface ' which should not be required anyway as no reason for fortran to require it but anyway i put in the interface command as follows.
integer*1 i,is ,j,j1,j2,m1,m2,np,npmx,nps
integer*1,allocatable::ilisin),ils)
common nps,npmx,np
npmx=2;nps=3
allocate(ilisin(nps),ils(2*nps-min(3,nps)))
call wigd(1,ilisin,0,ils)
end
interface
subroutine wigd(ii,ilisin,imn,ils);integer*1 i,ii,imn,np,nps
integer*1,allocatable::ilisin),ils);common nps,np
print*,"nps",nps
end; end interface
And it comes back with another error saying two main programs !! Does anyone know why this is not working ?
integer*1 i,is ,j,j1,j2,m1,m2,np,npmx,nps
integer*1,allocatable::ilisin),ils)
common nps,npmx,np
npmx=2;nps=3
allocate(ilisin(nps),ils(2*nps-min(3,nps)))
call wigd(1,ilisin,0,ils)
end
subroutine wigd(ii,ilisin,imn,ils);integer*1 i,ii,imn,np,nps
integer*1,allocatable::ilisin),ils);common nps,np
print*,"nps",nps
end
NOw it gives error as says interface required. So i read all about this ' interface ' which should not be required anyway as no reason for fortran to require it but anyway i put in the interface command as follows.
integer*1 i,is ,j,j1,j2,m1,m2,np,npmx,nps
integer*1,allocatable::ilisin),ils)
common nps,npmx,np
npmx=2;nps=3
allocate(ilisin(nps),ils(2*nps-min(3,nps)))
call wigd(1,ilisin,0,ils)
end
interface
subroutine wigd(ii,ilisin,imn,ils);integer*1 i,ii,imn,np,nps
integer*1,allocatable::ilisin),ils);common nps,np
print*,"nps",nps
end; end interface
And it comes back with another error saying two main programs !! Does anyone know why this is not working ?