源程序:
[Fortran] 纯文本查看 复制代码 program ex0811
implicit none
integer :: a,b
common /group1/ a
common /group2/ b
a=1
b=2
call ShowGroup1()
call ShowGroup2()
stop
end
subroutine ShowGroup1()
implicit none
integer :: num1
common /group1/ num1
write(*,*) num1
return
end
subroutine ShowGroup2()
implicit none
integer :: num1
common /group2/ num1
write(*,*) num1
return
end
我想把后面的子函数做成DLL
我的方法是:
[Fortran] 纯文本查看 复制代码 subroutine ShowGroup1()
!DEC$ ATTRIBUTES DLLEXPORT :: ShowGroup1
implicit none
integer :: num1
common /group1/ num1
write(*,*) num1
return
end
subroutine ShowGroup2()
!DEC$ ATTRIBUTES DLLEXPORT :: ShowGroup2
implicit none
integer :: num1
common /group2/ num1
write(*,*) num1
return
end
最后调用的结果与源程序不一样,想问一下什么原因? |