From: Thomas Koenig <tkoenig@netcologne.de>
To: "Ryan S. Elliott" <relliott@umn.edu>, fortran@gcc.gnu.org
Subject: Re: Darwin linker error "illegal text-relocation" with -shared
Date: Mon, 16 Apr 2018 18:20:00 -0000 [thread overview]
Message-ID: <dd809f00-65c1-954b-1c6e-cc8749e07739@netcologne.de> (raw)
In-Reply-To: <alpine.OSX.2.21.1804161104240.38779@er-10-128-80-101.wireless.umn.edu>
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" ?
next prev parent reply other threads:[~2018-04-16 18:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 16:18 Ryan S. Elliott
2018-04-16 18:20 ` Thomas Koenig [this message]
2018-04-16 19:35 ` Ryan S. Elliott
2018-04-16 19:46 ` Thomas Koenig
2018-04-16 19:51 ` Ryan S. Elliott
2018-04-16 20:14 ` Steve Kargl
2018-04-16 21:09 ` Ryan S. Elliott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd809f00-65c1-954b-1c6e-cc8749e07739@netcologne.de \
--to=tkoenig@netcologne.de \
--cc=fortran@gcc.gnu.org \
--cc=relliott@umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).