dlclose not calling destructors of static variables.

Andrew West andrewwest@gmail.com
Tue Feb 2 15:30:00 GMT 2010


On 02/02/2010 15:16, Christopher Faylor wrote:
> On Tue, Feb 02, 2010 at 09:36:54AM +0000, Andrew West wrote:
>    
>> O.k. I've changed remove_dll_atexit to;
>>
>> remove_dll_atexit (const dll *d)
>>   {
>>
>>     unsigned char *dll_beg = (unsigned char *) d->handle + 0x1000;
>>     unsigned char *dll_end = (unsigned char *) d->p.data_start;
>>      
> According to gdb, setting dll_end to this is functionally equivalent to
> using AllocationBase + RegionSize.  I thought you tried that already.
>
> But, anyway...
>    

I think Dave Korn mentioned that it's possible for the .text to be 
broken into multiple regions, so perhaps RegionSize
only shows the size of one of those multiple regions. There's another 
message on the list with more detail, either way
for me AllocationBase + RegionSize didn't match p.data_start for me.

>    
>> I tested my changes against my simple test case and against my full program and they
>> both seems to work fine.
>>      
> I've gotten rid of remove_dll_atexit and implemented Dave's other idea of
> specifically calling cxa_atexit when atexit is called from a DLL.  I realize
> this morning that this might require some additional tweaking to preserve
> the same order of calling but that's easily done.
>
> I'm waiting for approval on a newlib patch before rolling a new snapshot
> for this.
>
>    

Good stuff, I'll keep an eye on the snapshot site and give it a test 
once it's up.

Thanks both for your work on this.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list