Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28988 Discussions

Pass a 2D array into a F95 subroutine

erik2055
Beginner
999 Views
To pass a 2D array into a Fortran77 subtroutine, you need to pass the position of the first element (ByRef in VB).
I see in Lapack 3.1 routines (F77) , that the first dimension is allways passed as a parameter...

I see F95 routines, that just pass the array, NOT the first dimension.
fi. in MKL's dpbsvx.f90 one of the dimensions of an array is determined as : SIZE(AB,1)-1
How does the Fortran95 side know about the first dimension os the array ?

0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
999 Views
Quoting - erik2055
To pass a 2D array into a Fortran77 subtroutine, you need to pass the position of the first element (ByRef in VB).
I see in Lapack 3.1 routines (F77) , that the first dimension is allways passed as a parameter...

I see F95 routines, that just pass the array, NOT the first dimension.
fi. in MKL's dpbsvx.f90 one of the dimensions of an array is determined as : SIZE(AB,1)-1
How does the Fortran95 side know about the first dimension os the array ?


For "F77" and "F95" styles of array passing, see "assumed-size" and "assumed-shape" pages in the Intel Visual Fortran User and Reference Guide.

Assumed-shape arrays are implemented as "array descriptors" -- structures containing detailed dimension information, in a manner similar to VB SafeArrays. See for example the FOR_DESCRIPTOR_ASSIGN routine in help.
0 Kudos
Reply