fortran - 封装静态库中的 C 函数时,flag 找不到 iso_c_bindings
问题描述
我有一个用 C 编写的静态库mylib.a
,我正在尝试从 Fortran 首次调用 C。
我想在 Fortran 中调用 C 库中包含的以下函数:
double get_step(double value);
我尝试以下 Fortran 代码:
! TEST FORTRAN WRAPPER
module test
use, intrinsic :: iso_c_binding
! Interface to C routine
! double get_step(double value);
interface
real(c_double) function _get_step(value) bind(C, 'get_step')
use, intrinsic :: iso_c_binding, only : c_double
real(c_double) :: value
end function
end interface
end module
我尝试像这样编译它:
$ flang test.f90 mylib.a
F90-F-0004-Unable to open MODULE file iso_c_binding.mod (test.f90: 5)
F90/x86-64 FreeBSD Flang - 1.5 2017-05-01: compilation aborted
- 我究竟做错了什么?
- 我可以
get_step
为 Fortran 函数使用相同的名称吗?
解决方案
推荐阅读
- javascript - 仅在几个 img 标签上启用捏缩放
- python - 找不到
- django - Django 重定向到另一个视图
- performance - 我正在使用地图进行流式传输和分组,需要有关如何提高性能的建议
- ruby-on-rails - 在模型之外使用 aasm gem
- github - 如何编写具有中性检查运行状态的 GitHub 操作
- c# - 如何在c#中合并列表和匿名类型
- python - Jsonlines 文件导致 KeyError Python
- uitableview - 在 iOS 13 上进入编辑模式时 UITableViewCell 不缩进
- ckeditor - 在 TYPO3 8 中为 ck_editor 注册一个新的预设