From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29942 invoked by alias); 22 Jan 2013 11:52:43 -0000 Received: (qmail 29882 invoked by uid 48); 22 Jan 2013 11:52:28 -0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55891] Problem with shared library and EQUIVALENCE on darwin 11.4.2 x86_64 Date: Tue, 22 Jan 2013 11:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg02063.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55891 --- Comment #3 from Dominique d'Humieres 2013-01-22 11:52:27 UTC --- Form https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/E_ll5RFNL14 FX said: Compiling shared libraries on Darwin is a bit more tricky than on your typical Linux system. In your case, you're missing -flat_namespace: Two-level namespace By default all references resolved to a dynamic library record the library to which they were resolved. At runtime, dyld uses that informa- tion to directly resolve symbols. The alternative is to use the -flat_namespace option. With flat namespace, the library is not recorded. At runtime, dyld will search each dynamic library in load order when resolving symbols. This is slower, but more like how other operating systems resolve symbols. (from Mac OS ld man page). Typical use case for creating a Darwin shared library is: $ gfortran -dynamiclib -undefined suppress -flat_namespace -fPIC mod.f90 -o libfoo.dylib $ gfortran main.f90 -lfoo -L. && ./a.out 40 40 This PR should probably be closed as INVALID.