flang 从静态库中封装 C 函数时找不到 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
  • 我做错了什么?
  • 我可以对 Fortran 函数使用相同的名称 get_step 吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)