主题:vb调用Fortran的问题
我用vb调用dll
下面是Fortran程序:
SUBROUTINE arraytest(n,arr,s)
$ATTRIBUTES DLLEXPORT :: arraytest
INTEGER n
REAL arr(n),s
s=0.
DO i=1,n
s=s+arr(i)
END DO
END SUBROUTINE
vb代码:
Private Declare Sub ARRAYTEST Lib "E:\ss.dll" Alias "_ARRAYTEST@12" (X As Long, Y As Double, z As Double)
Private Sub form_Click()
Dim n As Long
Dim ab(100) As Double
n = 3
For i = 1 To n
ab(i) = i
Next i
Call ARRAYTEST(n, ab(1), s)
Print s
End Sub
最后的结果我想得到的是6,但是是0
小弟百思不得其解,求大侠相助
下面是Fortran程序:
SUBROUTINE arraytest(n,arr,s)
$ATTRIBUTES DLLEXPORT :: arraytest
INTEGER n
REAL arr(n),s
s=0.
DO i=1,n
s=s+arr(i)
END DO
END SUBROUTINE
vb代码:
Private Declare Sub ARRAYTEST Lib "E:\ss.dll" Alias "_ARRAYTEST@12" (X As Long, Y As Double, z As Double)
Private Sub form_Click()
Dim n As Long
Dim ab(100) As Double
n = 3
For i = 1 To n
ab(i) = i
Next i
Call ARRAYTEST(n, ab(1), s)
Print s
End Sub
最后的结果我想得到的是6,但是是0
小弟百思不得其解,求大侠相助