This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: shared libg2c?


On Tue, Oct 31, 2000 at 10:53:40PM +0100, Toon Moene wrote:
> nbecker@fred.net wrote:
> 
> > >>>>> "Toon" == Toon Moene <toon@moene.indiv.nluug.nl> writes:
> 
> >     Toon> nbecker@fred.net wrote:
> 
> >     >> I suggest libgc2 be installed shared as well as archive, where
> >     >> supported.
> 
> >     Toon> Note that for libg2c being installed shared *usefully* first of all the
> >     Toon> code has to be made reentrant.
> 
> > I don't understand.  Could you please elaborate?  Specifically, why is
> > it useful to have a non-reentrant archive lib, but it's not useful if
> > it's compiled as a shared lib?
> 
> Because it is not useful to have a non-reentrant shared lib, period :-)
> 
> The code (*all* code) in a shared library has to support multiple
> execution threads, because only one copy of the code is present,
> regardless of the number of "users" (i.e. callers of routines inside
> said shared library).
> 
> To be reentrant, code has to follow a few guidelines, one of which is:
> 
> *No static mutable variables, unless protected by a mutex*.

Don't modern dynamic linkers give each process its own copy of shared
libraries' global data?  If it weren't so, classic errno (before
thread-safe libc) could never have worked - and I know there were
shared libcs before there were thread-safe libcs...

Multiple threads - sharing data as well as code - is another can of
worms, but f77 doesn't support threads anyway, last I checked.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]