Your suggestion is a workarround. The other one is to turn the static library to dynamic one. ----- Original Message ---- From: Marc Glisse <marc.glisse@xxxxxxxx> To: Alexey Skidanov <skidanovalexey@xxxxxxxxx>; Jeffrey Walton <noloader@xxxxxxxxx> Cc: gcc-help@xxxxxxxxxxx Sent: Thu, October 21, 2010 11:14:15 PM Subject: Re: Global variable in static library - double free or corruption error On Thu, 21 Oct 2010, Alexey Skidanov wrote: > Actually, you claim that if some static library defines some global variable, > then it should NOT be linked with more then one shared library. Static libraries should only be linked with the executable. Shared objects are perfectly fine with undefined symbols. (Of course this is only a general rule, there can be good reasons to ignore it) On Thu, 21 Oct 2010, Jeffrey Walton wrote: > In essence, the rule creates "Shared (Global) Data Segments" in the > Microsoft world. Those things are quite dangerous (because one process > can cause another to crash) Er, I don't know about shared global data segments, but in this thread there is no mention of crossing the process boundary, only merging 2 variables in a given process. -- Marc Glisse