Re: strange arguments passing problem (from vba to fortran dll)



formulae translator wrote:
On May 29, 2:50 am, Arjen Markus <arjen.mar...@xxxxxxxxxx> wrote:
On 29 mei, 00:01, formulae translator <liwei19742...@xxxxxxxxx> wrote:

Dear all,
I encounter a strange problem when I am trying to pass arguments from
VBA (excel 2003) to fortran dll (compiled using CVF 6.6b).
debug in cvf environment shows some of the arguments are passed
correctly while some are not.
I attached part of the code here. The arguments passed correctly are
f_max, ppw, ma, para_H2. For other array arguments, only the first
elements are passed correctly.
any comments or suggestions are appreciated.
It looks as if only the scalar variables are passed correctly.
That does seem to make sense to me:

In VB you need to pass arrays like: ByRef array() As Double

In the code you posted the interfaces are missing the ().

Regards,

Arjen

Dear Arjen,

Thanks a lot for your prompt reply.

I tried the way you suggested, but got a compilor error (type
mismatch) from VBA.

The example in CVF document also has no "()" in "byref array as
double".

except for the two scalars (F_max and ppw), I have two arrays (ma and
para_H2) passed correctly.

I suspect the reason is that total size of arguments exceeds some
limit, but I am not sure because I cannot find any evidence to support
this.

Wei


You can test that hypothesis by stripping your code down to nothing but variable initialization in VB and the Fortran subroutine call; eliminate everything except for the subroutine arguments. If the values look right when you do that, then the problem is elsewhere. Add 'implicit none' to the Fortran code -- it can save you some bugs later on.

Louis
.



Relevant Pages

  • Re: strange arguments passing problem (from vba to fortran dll)
    ... I encounter a strange problem when I am trying to pass arguments from ... debug in cvf environment shows some of the arguments are passed ... In VB you need to pass arrays like: ...
    (comp.lang.fortran)
  • Re: size problem with ole object data type (blob) and ado.net
    ... For instance when using the Northwind database you ... _bitmap = new Bitmap; ... > I've a strange problem with ado.net and an Access db. ... > array of byte to strip every two bytes but the result is an visible ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: size problem with ole object data type (blob) and ado.net
    ... For instance when using the Northwind database you ... _bitmap = new Bitmap; ... > I've a strange problem with ado.net and an Access db. ... > array of byte to strip every two bytes but the result is an visible ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: size problem with ole object data type (blob) and ado.net
    ... For instance when using the Northwind database you ... _bitmap = new Bitmap; ... > I've a strange problem with ado.net and an Access db. ... > array of byte to strip every two bytes but the result is an visible ...
    (microsoft.public.dotnet.general)
  • Re: PASSING ARRAY FORTRAN DLL TO/FROM VBA EXCEL
    ... Let's say we have a Fortran subroutine that multiplies all elements of ... VBA Excel has an array as input and calls this fortran ... CVF and IVF have good documentation concerning mixed language ...
    (comp.lang.fortran)