From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61622 invoked by alias); 16 Apr 2018 18:20:40 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 61611 invoked by uid 89); 16 Apr 2018 18:20:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Yet, H*i:sk:alpine., HContent-Transfer-Encoding:8bit X-HELO: cc-smtpout1.netcologne.de Received: from cc-smtpout1.netcologne.de (HELO cc-smtpout1.netcologne.de) (89.1.8.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Apr 2018 18:20:37 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id 3C4961313E; Mon, 16 Apr 2018 20:20:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id 374D911E08; Mon, 16 Apr 2018 20:20:35 +0200 (CEST) Received: from [78.35.142.90] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 5ad4e973-02b8-7f0000012729-7f000001b445-1 for ; Mon, 16 Apr 2018 20:20:35 +0200 Received: from [192.168.178.68] (xdsl-78-35-142-90.netcologne.de [78.35.142.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Mon, 16 Apr 2018 20:20:33 +0200 (CEST) Subject: Re: Darwin linker error "illegal text-relocation" with -shared To: "Ryan S. Elliott" , fortran@gcc.gnu.org References: From: Thomas Koenig Message-ID: Date: Mon, 16 Apr 2018 18:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2018-04/txt/msg00082.txt.bz2 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" ?