Software Archive
Read-only legacy content
17061 Discussions

Problem with Visual Basic Calling Fortran DLL

Intel_C_Intel
Employee
209 Views
Ever thought you figured out a problem and then realized you still have not got a clue to how to fix it ?

I have read all the help and documentation but still cannot get VB to properly call a Fortran DLL. I am using Excel as a front end interface to some Fortran routines. I can pass double precision numbers and integers but cannot pass arrays. When I try to pass the array by specifying the first position of an array, d, only the first element is changed (i.e. CALL myroutine(d(1))).

Does anyone have any pieces of code or point to examples that shows how to properly call a FORTRAN DLL and pass mixtures of integers, arrays, multidimentional arrays of double precision numbers, etc. ?

My only other alternative is to write the data to a file to be accessed by VB and Fortran but that is so cave-man like I prefer not to.

Thanks in advance.

Jon
0 Kudos
1 Reply
Intel_C_Intel
Employee
209 Views
on,
Regarding to your problem that only the first element of array is passed from BB to FORT RAN DELL, I ran into a similar situation before. I found the solution by accident. Anyway, in your BB code, when you declare your multidimensional arrays, declare each of them separately. For example,
Dim arr1(1 to 10, 1 to 10)
Dim arr2(1 to 10, 1 to 10)
and not
Dim arr1(1 to 10), arr2(1 to 10)
Hopefully this is helpful.

Yeong
0 Kudos
Reply