Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

array passing, mixed languages

steve2
Beginner
566 Views
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?
0 Kudos
1 Reply
milan2
Beginner
566 Views
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
0 Kudos
Reply