您好,我想针对方法1提个问题:
vb的程序运行的时候没有exe产生的,请问我是要先“文件”——“生成工程”,再将这个exe的路径加在vs里吗?如下图。
但是程序似乎直接运行完了,没有在断点的地方暂停(按了逐语句F8,就直接从“Call suba(a, b, c)”跳到“Text1.Text = c”了,没有进入dll)。
我用来测试的vb主程序如下:
[Visual Basic] 纯文本查看 复制代码 Private Declare Sub suba Lib "D:\try_vb\c_dll\Dll1\Dll1\Debug\Dll1.dll" (ByRef a As Single, ByRef b As Single, ByRef c As Single)
Private Sub Command1_Click()
Dim a As Single
Dim b As Single
Dim c As Single
a = 10#
b = 2#
Call suba(a, b, c)
Text1.Text = c
End Sub
Fortran的DLL程序如下:
[Fortran] 纯文本查看 复制代码 subroutine suba(a,b,c)
!DEC$ ATTRIBUTES stdcall,DLLEXPORT ::suba
!DEC$ ATTRIBUTES ALIAS:"suba"::suba
!DEC$ ATTRIBUTES reference :: a,b,c
implicit none
real::a
real::b
real::c
c=a+b
end subroutine
|