I am trying to write a wrapper for \'allocate\' function, i.e. function which receives an array and dimensions, allocates memory and returns allocated array. The most import
subroutine memory(array, length)
has as it first dummy parameter 1-dimensional array (real(8), allocatable, intent(out), dimension(:) :: array
).
Calling this subroutine from your main program with 3-dimensional array foo (real(8), allocatable, dimension(:,:,:) :: foo
) is error obviously. And this is what compiler actually said.
If you really need such subroutines write one pair memory
/freem
subroutines for each array of different dimension - one subroutines pair for 1-dimensional array, another for 2-dimensional array, etc.
By the way, memory
subroutines will be different in general because in order to allocate n-dimensional array you need to pass n extents to above-mentioned subroutine.