主题:程序编译后的移植性问题
为了给FORTRAN程序打包,我用Intel Visual Fortran 11.1编译器在windows系统中进行编译,编译过程都正确。并在编译程序的文件夹下测试编译的执行文件成功。但是把执行文件和所依赖的DLL拷贝到同一机器的另一个文件夹里的时候,执行程序却不能运行了,并报错:
“无法启动此程序,因为计算机中丢失MSVCR90.DLL。尝试重新安装该程序以解决问题。”
请问我该怎么将编译好的执行文件移植到别的文件夹中,或者其它机器上呢?
下附我的代码和程序编译过程:
**** modll.f90 ****
module global
implicit real(kind(1.d0)) (a-h,o-z)
!DEC$ ATTRIBUTES DLLEXPORT :: x, n
allocatable :: x(:)
integer :: n
end module global
------------------------------------------------------
**** testdll.f90 ****
subroutine tsum(ave)
use global
!DEC$ ATTRIBUTES DLLEXPORT :: tsum
real*8 :: ave
write(*,"('dll: the array is: ',/,i4,/,10(5x,5f10.4))") n,(x(i),i=1,n)
ave = 0
do i = 1, n
ave = ave + x(i)
enddo
ave = ave / real(n)
return
end subroutine tsum
------------------------------------------------------
**** test.f90 ****
program test
use global
!
real*8 ave
n = 5
allocate(x(n))
do i = 1, n
x(i) = 10.d0*sin(3.14/real(i))
enddo
write(*,"('the array x is: ',/,10(5x,5f10.4,/))") x
call tsum(ave)
write(*,"('the average is: ',/,5x,f10.4)") ave
end
------------------------------------------------------
程序的命令行编译命令是:
ifort /dll modll.f90
ifort /dll testdll.f90 modll.lib
ifort /MD test.f90 testdll.lib modll.lib
“无法启动此程序,因为计算机中丢失MSVCR90.DLL。尝试重新安装该程序以解决问题。”
请问我该怎么将编译好的执行文件移植到别的文件夹中,或者其它机器上呢?
下附我的代码和程序编译过程:
**** modll.f90 ****
module global
implicit real(kind(1.d0)) (a-h,o-z)
!DEC$ ATTRIBUTES DLLEXPORT :: x, n
allocatable :: x(:)
integer :: n
end module global
------------------------------------------------------
**** testdll.f90 ****
subroutine tsum(ave)
use global
!DEC$ ATTRIBUTES DLLEXPORT :: tsum
real*8 :: ave
write(*,"('dll: the array is: ',/,i4,/,10(5x,5f10.4))") n,(x(i),i=1,n)
ave = 0
do i = 1, n
ave = ave + x(i)
enddo
ave = ave / real(n)
return
end subroutine tsum
------------------------------------------------------
**** test.f90 ****
program test
use global
!
real*8 ave
n = 5
allocate(x(n))
do i = 1, n
x(i) = 10.d0*sin(3.14/real(i))
enddo
write(*,"('the array x is: ',/,10(5x,5f10.4,/))") x
call tsum(ave)
write(*,"('the average is: ',/,5x,f10.4)") ave
end
------------------------------------------------------
程序的命令行编译命令是:
ifort /dll modll.f90
ifort /dll testdll.f90 modll.lib
ifort /MD test.f90 testdll.lib modll.lib