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

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

 



> that there can only ever be one definition of a symbol in a program, and
> UNIX has always merged multiple definitions to achieve this
Does the rule include that gloabl object destructors are to run on
every unload, or the last/final unload or last call to dlclose (when
the shared object gets unmapped)? Many folks don't expect their
objects will be pulled out from under them until the last unload. It
seems like a reasonable expectation to me.

>  it's just something to get used to
Agreed.

On Thu, Oct 21, 2010 at 12:10 PM, Andrew Haley <aph@xxxxxxxxxx> wrote:
> 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