Re: PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL



Thanks so much. I will try it.

Irfan


On Sep 22, 9:25 am, dpb <n...@xxxxxxx> wrote:
kis wrote:
Can you pls give me an example code that does this?
FYI, I use CVF 6.6

...
There is a section on arrays in mixed-language programming in the CVF
documentation in the mixed language programming section as well as
sample projects for each data type (strings, variables, arrays, UDTs, ...)

One small section contains the following snippet; reading the section
will enlighten greatly...

Handling Arrays and Visual Fortran Array Descriptors
...
To pass an array from Visual Basic to Fortran, pass the first element of
the array. By default, Visual Basic passes variables by reference, so
passing the first element of the array will give Fortran the starting
location of the array, just as Fortran expects. ...

  ' In Basic
  Declare Sub FORTARRAY Lib "fortarr.dll" (Barray as Single)
  DIM barray (1 to 3, 1 to 7) As Single
  Call FORTARRAY(barray (1,1))

  ! In Fortran
  Subroutine FORTARRAY(arr)
     REAL arr(3,7)

--

.