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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/21/2010 04:34 PM, Alexey Skidanov wrote:

> Thanks for your response. You are absolutely right regarding to
> -Wglobal-variable. I would prefer to get some kind of error (linking
> error?) about two global variables with the same name instead of dynamic
> loader/linker decision to "merge" them.

This is standard, and correct behaviour.  The One Definition Rule says
that there can only ever be one definition of a symbol in a program, and
UNIX has always merged multiple definitions to achieve this.  Also, plenty
of programs depend on this behaviour: it's just something to get used to.

Andrew.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux