Hi:

I'm trying call a dll by fortran(by cvf 6.6) from vb6.0

the code as:

in vb:

Private Declare Sub Dll2 Lib "d:\Dll2.dll" (ByRef a As Single, ByRef b As Single, ByRef n As Long)


Private Sub Command1_Click()
Dim mya(1) As Single
Dim myb(1) As Single
Dim n As Long
mya(0) = 1.01
mya(1) = 1.1
myb(0) = 3.1
myb(1) = 4.1
n = 2
Call Dll2(mya(0), myb(0), n)
aa = myb(1)
End Sub


in fortran:

module testdll
IMPLICIT NONE
contains
subroutine Dll2(a,b,n)
! Expose subroutine Dll2 to users of this DLL
!DEC$ ATTRIBUTES :: Dll2
!DEC$ ATTRIBUTES DLLEXPORT,ALIAS: "Dll2":: Dll2
integer n
real a(n)
real b(n)
b(1)=a(1)
b(2)=a(2)
end subroutine Dll2
end module

It seems easy. but, b(0) get the right number, 1.01, however, b(1)get a wild number, such as 3.3453664E-43 .


i have tried run the same code in vb.net, and it works well!