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?


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.

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