array passing, mixed languages

array passing, mixed languages

How do you pass arrays between fortran and vb in a dll? Everytime I try to do it, I get an illegal data error in the call statement. I declare an array in my interface section in fortran, and I declare an array in vb, but for some reason it doesn't work. Can anyone give me some help?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

FORTRAN CODE:

SUBROUTINE main(MATEFOUT)
!DEC$ ATTRIBUTES DLLEXPORT :: main
!DEC$ ATTRIBUTES ALIAS : 'main' :: main

INTEGER*2 :: MATEFOUT(4000, 2)

BASIC CODE:
Write this in a module:
Public Declare Sub main Lib "myprogram.dll" (MATEF As Integer)
Write this inside your subroutine:
Dim MATEF(1 To 4000, 1 To 2) As Integer
Call main(MATEF(1, 1))

I have experience only with numerical arrays. It works for all numerical variable types.

Hope it helps you,

Milan

Login to leave a comment.