【发布时间】:2015-03-08 02:46:33
【问题描述】:
我曾经这样做,在一个名为 umat.f90 的文件中,
!!! umat.f90
module1
!! Content of module1
end module1
module2
!! Content of module2
end module2
!! This has to be a subroutine to interface with some legacy code in a software called ABAQUS
subroutine umat (argument-list)
use module1
use module2
!! Content of umat
end subroutine umat
这行得通。我可以使用ifort -c umat.f90,然后它会生成一个umat.obj 链接到一个名为ABAQUS 的软件(我无法修改)。现在,因为 module1 和 module2 可能会被重复使用,我想将它们保存在单独的 .f90 文件中以符合 DRY 原则。所以,这变成了三个独立的文件:
文件#1:
!!! module1.f90
module1
!! Content of module1
end module1
文件 #2:
!!! module2.f90
module2
!! Content of module2
end module2
文件#3:
!!! umat.f90
!! This has to be a subroutine to interface with some legacy code in a software called ABAQUS
subroutine umat (argument-list)
use module1
use module2
!! Content of umat
end subroutine umat
但是,现在如果我运行ifort /c module1.f90 module2.f90 umat.f90,它将生成 3 个 obj 文件。 umat.obj 似乎不再包含来自module1 和module2 的模块信息。
鉴于我只能提供一个.obj 文件与ABAQUS 接口,我可以将它们编译成一个大.obj 文件吗?
PS:我知道我可以使用 python 脚本每次自动将三个文件复制并粘贴到一个文件中,但这似乎是一种非常肮脏和不雅的方式。
【问题讨论】:
标签: fortran fortran90 intel-fortran