------- Comment #3 from iwan at irs dot phy dot nrc dot ca 2005-10-28 23:22 ------- Subject: Re: Fortran I/O to same unit number in main program and in a shared library
>------- Comment #1 from pinskia at gcc dot gnu dot org 2005-10-28 21:40 ---- >Why are you not linking against the shared library version of libgfortran? >What you are doing seems wrong and unsupported. > If I do that, after the shared library has opened unit 1, all output from the main program goes there and this is not what I want. With the Intel and PGI compilers linking the shared library with -Wl,-Bsymbolic is sufficient to make the main program and the shared library to have independent I/O. With the GCC 3.x compilers one needed to link against the static g2c. This no longer works with GCC 4.x. Both the shared library and the main program are huge packages using tens of different I/O units => It i not easy to simply find and replace I/O units everywhere. > ------- Comment #2 from pinskia at gcc dot gnu dot org 2005-10-28 21:43 > ------- Anyways I think this is really a dup of bug 22298. > Also note the static library really needs to be compiled with -fPIC if you > are linking it in a shared library (by default it is not). > The static gfortran library is made with -fPIC (otherwise the linker refuses to create a shared library on x86_64 when linking against it) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24576