在 Windows 7 上编译 Fortran .dll(免费)?

发布于 2025-01-08 00:52:33 字数 452 浏览 2 评论 0原文

我的老板刚刚要求我将他老板的旧 Fortran 代码集成到我正在开发的一个项目(Java)中。该代码是在 90 年代编写的,所以我想它仍然可以编译,所以我希望我可以从 .dll 中调用函数,而不是重新编写它。我已经调用了一些 C .dll,所以我想我已经涵盖了该部分。

我一直在阅读一些文章,大多数文章都讨论了将 Intel Visual Fortran 编译器集成到 Microsoft Visual Studio 中。我们已经获得了 Visual Studio 的大学站点许可证,但看起来 Intel Visual Fortran 编译器的价格在 700 美元左右。我认为我的老板不会这么做,所以我正在寻找其他选择。我知道微软通过 Project Dreamspark 向学生免费提供了很多产品,但我没有看到任何与 Fortran 相关的产品。

我现在正在寻找一些基于 cygwin 的选项(我认为是 g95),但我正在寻找其他想法/选项。有什么想法吗?

My boss just asked me to integrate his bosses old Fortran code into a project (Java) I'm working on. The code was written in the 90s, so I imagine it'll still compile, so rather than re-write it, I'm hoping I can just call the functions from a .dll. I'm already calling some C .dlls, so I think I've got that part covered.

I've been doing some reading, and most of the articles talk about integrating the Intel Visual Fortran Compiler into Microsoft Visual Studio. We've got a university site license for Visual Studio, but it looks like the Intel Visual Fortran Compiler is in around the $700 range. I don't think my boss will go for that, so I'm looking for another option. I know Microsoft makes a lot of products freely available to students via Project Dreamspark, but I didn't see anything Fortran related.

I'm looking at some cygwin based options right now (g95, I think), but I'm looking for other ideas/options. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

时光倒影 2025-01-15 00:52:33

我使用带有 -shared 标志的 gfortran (g95) 编译器来创建 DLL。首先使用以下命令编译 .for/.f90 文件:

gfortran -c myfile1.f90
gfortran -c myfile2.f90

然后:

gfortran -shared -o mydll.dll myfile1.o myfile2.o

I've used the gfortran (g95) compiler with the -shared flag to create DLLs. first compile the .for/.f90 files with:

gfortran -c myfile1.f90
gfortran -c myfile2.f90

then:

gfortran -shared -o mydll.dll myfile1.o myfile2.o
等风来 2025-01-15 00:52:33

MinGW 将允许您创建一个可与您的 MS 内容一起使用的 DLL。

MinGW will let you create a DLL that will work with your MS stuff.

装迷糊 2025-01-15 00:52:33

查找 Windows 的 GCC 端口,例如 MingwGCW。这两个文件都会创建可在 Visual Studio 中链接到的 .obj 文件。或者您可以随意配置 VS 以将这些命令行编译器之一调用到项目中。但由于代码是相对静态的,因此希望它可能是一个很好的编译一次并忘记它的任务。

Look for a GCC port to Windows, such as Mingw or GCW. Both those will create .obj files which can be linked to in Visual Studio. Or you could futz around and configure VS to invoke one of those command line compilers into the project. But since the code is relatively static, it might be a nice compile once and forget it task, hopefully.

淑女气质 2025-01-15 00:52:33

不要指望 Microsoft 在 Fortran 方面提供太多帮助。
他们花了数年时间试图消灭它,转而使用 Visual Basic / C。

您可以尝试 Silverfrost 的编译器。

http://www.silverfrost.com/11/ftn95/ftn95_fortran_95_for_windows.aspx

这是免费提供的(“个人版”版本)并可与 Visual Studio 配合使用。
它基本上是一个 F90/F95 编译器,包含一系列后续功能。
你没说老老板的代码是F77还是F90写的。
但我认为 Silverfrost 将以最小的更改处理旧代码。

如果您觉得效果不错,还可以根据需要升级到学术版本和企业版本。

Don't expect much help from Microsoft on Fortran.
They spent years trying to kill it off in favour of Visual Basic / C.

You could try Silverfrost's compiler.

http://www.silverfrost.com/11/ftn95/ftn95_fortran_95_for_windows.aspx

This is available free ('personal edition' version) and works with Visual Studio.
It's basically a F90/F95 compiler with a selection of later features included.
You did not say if the old boss' code was written in F77 or F90.
But I think that Silverfrost will handle the old code with minimal changes.

If it turns out well for you, there's also an academic version and an enterprise edition to move up to as desired.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文