This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55891] Problem with shared library and EQUIVALENCE on darwin 11.4.2 x86_64
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 22 Jan 2013 11:52:27 +0000
- Subject: [Bug fortran/55891] Problem with shared library and EQUIVALENCE on darwin 11.4.2 x86_64
- Auto-submitted: auto-generated
- References: <bug-55891-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55891
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 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.