June 1st, 2014, 01:43 PM
something wrong when call a fortran dll from vb 6.0
I'm trying call a dll by fortran(by cvf 6.6) from vb6.0
the code as:
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)
! Expose subroutine Dll2 to users of this DLL
!DEC$ ATTRIBUTES :: Dll2
!DEC$ ATTRIBUTES DLLEXPORT,ALIAS: "Dll2":: Dll2
end subroutine Dll2
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!
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.