This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: Global variable in static library - double free or corruption error





----- Original Message ----
> From: Andrew Haley <aph@redhat.com>
> To: noloader@gmail.com
> Cc: Alexey Skidanov <skidanovalexey@yahoo.com>; Alexey Skidanov 
><Alexey.Skidanov@orbotech.com>; gcc-help@gcc.gnu.org
> Sent: Fri, October 22, 2010 3:02:13 PM
> Subject: Re: Global variable in static library - double free or corruption 
>error
> 
> On 10/22/2010 01:22 PM, Jeffrey Walton wrote:
> > On Fri, Oct 22, 2010 at 4:32 AM, Andrew Haley <aph@redhat.com> wrote:
> >> Please stop top-posting.? It makes it very hard to reply to you.
> >>
> >> On 10/21/2010 09:01 PM, 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.
> >>
> >> In the same process, yes.? That's absolutely true.
> >>
> >>> That is, if you
> >>> have the dependencies tree like in my example then you have a problem. 
>Think
> >>> about such static library is third party library where I can't change the 
>code.
> >>>
> >>> Regarding the ODR. You are absolutly right. But what about a MULTIPLE 
>variable
> >>> initialization. Is it correct behaviour according to standard?
> >>
> >> I don't know what you mean by a "MULTIPLE variable initialization".
> > I believe he means the constructor running multiple times (the
> > antithesis of the destructor running multiple times).
> 
> I see, thanks.
> 
> Well, unless there's a bug you can't get that unless you break the
> ODR.

Do you mean, once I break the ODR the?further behaviour is unexpected?

You are right. I break it. And I would like to get linker/loader error/warning 
as I get linking?two object files with the same global variable defined in each 
file ( "Symbol zzz already defined" or something like that). 


> 
> Andrew.
> 




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