本帖最后由 li913 于 2016-1-10 18:57 编辑
给你个例子作为参考。[Visual Basic] 纯文本查看 复制代码 Public Class Form1
Private Declare Sub exdll Lib " d1.dll" (ByVal a As Integer, ByVal b As Integer, ByVal c As pro1)
Delegate Sub pro1(ByRef a As Integer, ByRef b As Integer)
Private Sub pro(ByRef a As Integer, ByRef b As Integer)
Dim c As Integer
c = a * b
Debug.Print(c)
MsgBox(c.ToString)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim x, y As Integer
x = 2
y = 5
Call exdll(x, y, AddressOf pro)
End Sub
End Class
[Fortran] 纯文本查看 复制代码 !Fortran代码:
subroutine exdll(x,y,bkpro)
!DEC$ ATTRIBUTES stdcall,DLLEXPORT :: exdll
!DEC$ ATTRIBUTES alias : "exdll" :: exdll
!DEC$ ATTRIBUTES value :: x,y
!DEC$ ATTRIBUTES reference :: bkpro
integer(4) x,y,a,b
interface
subroutine bkpro(a,b)
integer(4) a,b
end subroutine
end interface
a=x+1
b=y+1
call bkpro(a,b)
end subroutine exdll |