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

Passing 2D arrays bewteen VB.net and IVF

Earl_Geddes
New Contributor I
610 Views
Has anyone noticed that the array dimensions in VB.net are the reverse of those in IVF. Its easy to demonstrate. Setup a2 x3 array in in VB and pass it into IVF through a subroutine. Now make each element in IVF its location, i.e. 1,1 = 11, 1,2 = 12, 3,1 = 31. Exit back to VB and examine the elements in the watch windown. The elements will not line up correctly. Remember that the option bases for the two languages are not the same but this does not matter.

Any comments? I don't think that it is supposed to do this.

In VB.net the second index increments first and in IVF the first index increments first.
0 Kudos
4 Replies
mecej4
Honored Contributor III
610 Views
Check out row-major order and column-major order at, e.g., Wikipedia.
0 Kudos
anthonyrichards
New Contributor III
610 Views
It is the same with C and C++ and has always been so.
0 Kudos
Earl_Geddes
New Contributor I
610 Views
Thanks, I was not aware of that. I had passed arrays between VB and FORTRAN before, but only one dimensional or an array of structures, which aren't an issue. This was the first time that I had passed a 2D array.

Curious thing is that there is no mention of this what-so-ever in the IVF help. I would think that an important topic to cover.
0 Kudos
mecej4
Honored Contributor III
610 Views
The topic is covered in the Mixed Language Programming chapter of the Intel Fortran User Guide under "Handling Arrays and Fortran Array Descriptors". You will have to supplement what is said there for the Fortran side with similar descriptions for the VB side from the VB manuals.
0 Kudos
Reply