vb调用fortran的dll
Fortran源程序:SUBROUTINEARRAYTEST(n,arr)!$ATTRIBUTESDLLEXPORT::ARRAYTESTINTEGERn,i,jREAL...
Fortran源程序:
SUBROUTINE ARRAYTEST (n, arr)
! $ ATTRIBUTES DLLEXPORT :: ARRAYTEST
INTEGER n, i, j
REAL (4) arr (3, 3)
DO i= 1, 3
DO j= 1, 3
arr ( i, j) = 10.1*i+j
END DO
END DO
n= n+ 10
END SUBROUTINE
VB源程序(一个窗体,两个文本框,一个命令控件):
模块里为:Private Declare Sub ARRAYTEST Lib "C:\xinjian\exam\Debug\exam.dll" Alias "_ARRAYTEST@8" (X As Long, Y As Single)
Private Sub Command1_Click()
Dim a As Long
Dim ab(1 To 3, 1 To 3) As Single
a = 10
Call ARRAYTEST(a, ab(1, 1))
Text1.Text = Str(a)
Text2.Text = Str(ab(3, 3))
End Sub
运行显示函数未定义,应该怎么解决呀?求助! 展开
SUBROUTINE ARRAYTEST (n, arr)
! $ ATTRIBUTES DLLEXPORT :: ARRAYTEST
INTEGER n, i, j
REAL (4) arr (3, 3)
DO i= 1, 3
DO j= 1, 3
arr ( i, j) = 10.1*i+j
END DO
END DO
n= n+ 10
END SUBROUTINE
VB源程序(一个窗体,两个文本框,一个命令控件):
模块里为:Private Declare Sub ARRAYTEST Lib "C:\xinjian\exam\Debug\exam.dll" Alias "_ARRAYTEST@8" (X As Long, Y As Single)
Private Sub Command1_Click()
Dim a As Long
Dim ab(1 To 3, 1 To 3) As Single
a = 10
Call ARRAYTEST(a, ab(1, 1))
Text1.Text = Str(a)
Text2.Text = Str(ab(3, 3))
End Sub
运行显示函数未定义,应该怎么解决呀?求助! 展开
1个回答
展开全部
补充: 你把邮箱留下,我给你把源代码发过去。。。
我试了, 代码执行正常...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
我看了一下,应该是Exam.dll中没有ARRAYTEST函数,
我用的Compaq Visual Fortran 6版本,
把! $ ATTRIBUTES DLLEXPORT :: ARRAYTEST
改成:!ms$ ATTRIBUTES DLLEXPORT::ARRAYTEST
如结果正确,请鼓掌一下以示庆贺,并在下面网址留言
http://hi.baidu.com/juncox/blog/item/a722792809b303f699250ae9.html
编译后,通过Depends查看,结果如图
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询