M.E.
M.E.

Reputation: 5515

flang can not find iso_c_bindings while encapsulating a C function from a static library

I have a static library named mylib.a written in C and I am trying to do my first call to C from Fortran.

I want to invoke in Fortran the following function contained in the C library:

double get_step(double value); 

I try the following Fortran code:

! 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

I try to compile it like this:

$ 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

Upvotes: 0

Views: 272

Answers (0)

Related Questions