Passing arrays through fortran dll from vb.net app turning to single element arrays. Should i pass only the first element? -


I have a VB.net console app and I'm opening the function in a DLL written in the Fortran. I am passing 3 arrays through the reference by reference. When they come out from other people, they all look for arrays of only one element. And that element is 0.

I have read somewhere on the internet that while talking like this, it is a good idea to pass the first element of the array in this function. I tried to change my function announcement to accept single elements instead of single-dimensional arrays, and now the array is the same length before and after the call, but they do not change at all, so I'm not sure that this work Has been doing.

Anyone have any such problem or know what to try? Any help will be very much appreciated.

Fortran functions only get pointers, regardless of any array or single value.

I do not know how you can do this in VB.net, but try to find a way to send the first object to the pointer.

In C, this should be:

  double * a = ...; Fortran_func (a); // or ... FORTRAN_FUNK (and [0]);  

Also, be sure to send the right type floating point (for real * 8 vs real * 4, double versus single precision). Once in Fortran, you will not know the size of the array, you will need to accept it.

  SUBROUTINE FORTRAN_FUNK (A) REAL * 8A (16) ... END  

If the size is not stable, then maybe something like this

  SUBROUTINE FORTRAN_FUNK (A, SJ) Actual * 8A (SJ) integer sz ... end  

Then send an integer as an indicator in C It will:

  int sz = 16; Fortran_func (a, & amp; sz);  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -