Re: Lifetime of local variables: global versus member function

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

 



Jan van Dijk <jan@xxxxxxxxxxxxxxxxxx> writes:

> If I comment in line 11 of the library module (marked CULPRIT), thus calling 
> class_scope_f(), and try again, the result is:
>
> Opening: /home/jan/src/gum-cvs/ideas/jan/libtest.so
> Handle after dlopen: 0x602050
> Handle after dlclose: 0x602050
> Exiting...
> Destructor called
>
> Now the library unloading fails (the handle is still !=0, and indeed the 
> destructor of c is not called before the program terminates).

This certainly looks like a bug.  I can recreate it using gcc 4.5.1 and
glibc 2.13.

> I assume this is because there is a difference in lifetime between local 
> static variables in functions in global scope vs. those of member functions. 
> Is this the intended behaviour? (I say 'intended', not 'mandated', because I 
> know so's are beyond the scope of ISO-C++.) If not, should I file a report?

Please do file a bug report.  Thanks.

Ian


[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