Skif
12-22-2008, 07:18 AM
Hi at all
I a problem with a fortran pointer.
I must do a dynamic vector with a pointer:
!********
subroutine pippo()
...
integer, pointer, dimension(:) :: pVec
...
stop
end
!********
if in the subroutine I dimension the vector I don't have problem
!********
subroutine pippo1()
...
integer, pointer, dimension(:) :: pVec
allocate (pippo(1))
pippo(1) = 999 !OK
...
stop
end
!********
the subroutine pippo1 is ok
but if I define the vector dimension of pVec in another sub
I a problem of access violation
!********
subroutine pippo2()
...
integer, pointer, dimension(:) :: pVec
call load(pVec)
...
stop
end
subroutine load(pVec)
implicit none
integer, pointer, dimension(:) :: pVec
allocate(pVec(1)) !ERROR
return
end
!********
do you knows how to do?
thanks!!
I a problem with a fortran pointer.
I must do a dynamic vector with a pointer:
!********
subroutine pippo()
...
integer, pointer, dimension(:) :: pVec
...
stop
end
!********
if in the subroutine I dimension the vector I don't have problem
!********
subroutine pippo1()
...
integer, pointer, dimension(:) :: pVec
allocate (pippo(1))
pippo(1) = 999 !OK
...
stop
end
!********
the subroutine pippo1 is ok
but if I define the vector dimension of pVec in another sub
I a problem of access violation
!********
subroutine pippo2()
...
integer, pointer, dimension(:) :: pVec
call load(pVec)
...
stop
end
subroutine load(pVec)
implicit none
integer, pointer, dimension(:) :: pVec
allocate(pVec(1)) !ERROR
return
end
!********
do you knows how to do?
thanks!!