I have the folowing problem. In my F2003 code I use 2 dimensional arrays to store some data. I need to pass this data to some external code which expects a pointer to an 1D array. Because these arrays are big I do not want to copy the data but this causes a lot op problems for me since whatever I try it get compiler errors or a crash at runtime.
Does sombody knows a way around these compiler checks?
Here is some code to illustrate my problem
integer, pointer :: Array2D(:,:)
integer, pointer :: Array1D(:)
Array2D(1,1) = 1
Array2D(2,1) = 2
Array2D(1,2) = 3
Array2D(2,2) = 4
!!! Copies data
Array1D(1:4) = Transfer(Array2D,Array1D) !!! Works fine but copies data
!!! Attempt 1
Array1D(1:4) => Array2D(:,:) !!! Compiler error: If a bound remapping list is specified, data target must be simply contiguous or of rank one. [ARRAY2D]
!!! Attempt 2
Array1D => Transfer(Array2D,Array1D) !!! Compiler Error: When the target is an expression it must deliver a pointer result.