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?


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*.

Skim the libg2c sources - where's the static variable, and where's the
mutex :-)

[ Note: The above analysis is based on my experience building and
  maintaining the equivalent(s) of shared libraries on Sperry Univac's
  EXEC 37.x, called (Configured) Common Banks, about 17-18 years ago.
  Don't take this as gospel ... ]

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

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