Darwin linker error "illegal text-relocation" with -shared

Thomas Koenig tkoenig@netcologne.de
Mon Apr 16 18:20:00 GMT 2018


Hello Ryan,

> foo.f90
> ----------------------------------------------
> module foo contains
>    subroutine bar
>      use, intrinsic :: iso_c_binding
>      call gee(c_funloc(gee))
>    end subroutine
>    subroutine gee(f) bind(c)
>      use, intrinsic :: iso_c_binding
>      type(c_funptr) :: f
>    end subroutine
> end module foo
> ----------------------------------------------
> 
> $ gfortran-7 -shared foo.f90

You are invoking gfortran without the "-c" option, so it expects to
generate an executable. Yet, you specify "-shared", which only makes
sense for a library, and your source code does not contain a main
program.

What happens if you run

"gfortran -c -shared foo.f90" ?



More information about the Fortran mailing list