PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL         


Author: kis
Date: Sep 19, 2008 08:28

Hello Experts,

It might not be appropriate to address this question here.

I tried to create Fotran dll file and asked VBA to call it. A very
simple example:
Let's say we have a Fortran subroutine that multiplies all elements of
an array by 10.
Then, VBA Excel has an array as input and calls this (dll) fortran
subroutine and will get the array multiplied by 10.

I always fail to do so with array as input, however find no problem
with single-valued variable.

Look forwards to hearing from you.

Thanks,
Irfan
4 Comments
Re: PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL         


Author: e p chandler
Date: Sep 19, 2008 09:49

On Sep 19, 11:28 am, kis gmail.com> wrote:
> Hello Experts,
>
> It might not be appropriate to address this question here.
>
> I tried to create Fotran dll file and asked VBA to call it. A very
> simple example:
> Let's say we have a Fortran subroutine that multiplies all elements of
> an array by 10.
> Then, VBA Excel has an array as input and calls this (dll) fortran
> subroutine and will get the array multiplied by 10.
>
> I always fail to do so with array as input, however find no problem
> with single-valued variable.
>
> Look forwards to hearing from you.
>
> Thanks,
> Irfan
Show full article (0.86Kb)
no comments
Re: PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL         


Author: kis
Date: Sep 22, 2008 06:43

Can you pls give me an example code that does this?
FYI, I use CVF 6.6

Thanks,
Irfan

On 19 Sep, 11:49, e p chandler juno.com> wrote:
> On Sep 19, 11:28 am, kis gmail.com> wrote:
>
>
>
>> Hello Experts,
>
>> It might not be appropriate to address this question here...
Show full article (1.06Kb)
no comments
Re: PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL         


Author: dpb
Date: Sep 22, 2008 07:25

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))
Show full article (0.94Kb)
no comments
Re: PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL         


Author: kis
Date: Sep 22, 2008 11:56

Thanks so much. I will try it.

Irfan

On Sep 22, 9:25 am, dpb non.net> 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...
Show full article (1.09Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Re: strange arguments passing problem (from vba to fortran dll)comp.lang.fortran ·