VB调用fortran的DLL问题求助
我需要用VB调用fortran的DLL,但在调试过程中出现 "实时错误 49 DLL调用约定错误".但是生成工程exe文件却可以正常使用,纠结两天无果,求VB高手们能答疑解惑.下面是编的是简单的VB调用程序测试用:
Option Base 1
Option Explicit
Private Declare Sub FSTIF Lib "DLL3.dll" (ByRef A As Single, ByRef B As Single, ByRef X0 As Single, ByRef FK As Single, ByRef XM As Single, ByRef DENF As Single)
Private Sub Command1_Click()
Dim A As Single, B As Single, X0 As Single, XM As Single, DENF As Single
Dim FK(4, 4) As Single
Dim i As Integer, j As Integer
A = 18#
B = 12#
X0 = 54#
DENF = 0.035885
XM = 1#
Call FSTIF(A, B, X0, FK(1, 1), XM, DENF)
For i = 1 To 4
For j = 1 To 4
Text1.Text = Text1.Text & FK(i, j) & " "
Next j
Text1.Text = Text1.Text & vbCrLf
Next i
End Sub
下面是fortran的代码:
SUBROUTINE FSTIF(A,B,X0,FK,XM,DENF)
!DEC$ attributes dllexport ::FSTIF
!DEC$ attributes alias: "FSTIF" ::FSTIF
!DEC$ attributes reference ::A,B,X0,FK,XM,DENF
REAL A,B,X0,FK(4,4),XM,DENF
DIMENSION A1(4,4),A2(4,4),A3(4,4) ......后面是计算部分就不粘了
如上,在VB编译中启动程序会报错误,但生成exe文件却正常.