This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: shared libg2c?
- To: toon at moene dot indiv dot nluug dot nl
- Subject: Re: shared libg2c?
- From: Marc Espie <espie at quatramaran dot ens dot fr>
- Date: Thu, 9 Nov 2000 15:08:22 +0100
- Cc: gcc at gcc dot gnu dot org
- Organization: Ecole Normale Superieure (quatramaran)
- References: <x88y9z6xtls.fsf@adglinux1.hns.com><39FDCF4D.92E16BD3@moene.indiv.nluug.nl> <x88d7giyse7.fsf@adglinux1.hns.com>
In article <39FF3F64.A9F48A0D@moene.indiv.nluug.nl> you write:
>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).
You're probably refereing to a windows model, or something.
On Unix systems, static variables end up in a data section, so that each
process gets its own copy of the data (copy-on-write, no less, so that
it stays shared until you modify it).
What you're refering to is only useful for multi-threading, there is
absolutely no reason to require it for shared libraries. In fact, most
shared libraries out there are not thread-safe.