On Linux, why does the destructor run twice on shared instance of global variable in C++? -


On Linux I have generated some C ++ code from a static library that defines global variables. An example of this global variable is shared between two shared libraries, which refers to its symbol.

When the process is closed and the static ending phase is run, I see that the destroyer is run twice at this shared frequency! Probably every time the library is unloaded.

This question is closely related to the other. I recently seen here:

Does anyone know the theoretical interpretation behind this behavior?

If you take a nude indicator and put it in smart pointer (twice), then Will be destroyed twice, once for every container refractor, falling from zero.

So, if you pass a nude pointer in both libraries, then it can do it, each person puts it in a shared indicator object and destroys each of them. If you can see the stack backatas during dtor, then it should be shown happening in both libraries.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -