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.

Reply via email to