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