dlclose not calling destructors of static variables.

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Tue Feb 2 15:16:00 GMT 2010


On Tue, Feb 02, 2010 at 09:36:54AM +0000, Andrew West wrote:
>On 01/02/2010 21:24, Dave Korn wrote:
>> On 01/02/2010 20:45, Andrew wrote:
>>
>>    
>>> I'm not looking to submit a patch to fix this, I'll leave that up to the
>>> professionals who have a better idea about the whole picture. It's just
>>> I've hit a brick wall with my code with this bug so I'm looking for some
>>> work arounds for myself.
>>>      
>>    No, really, you've been a ton of help, thanks a million.  Try the patch I
>> just posted to the cygwin-patches list, on top of current CVS:
>>
>> http://cygwin.com/ml/cygwin-patches/2010-q1/msg00051.html
>>
>>    That should get you going with your current DLLs.
>>
>>    Next step is to add the cxx abi functions.  I found an old patch lying
>> around, seems I started looking at this back in August and then lost track of
>> it somehow (probably in the rush approaching the end of gcc stage 1, I guess),
>> so I owe you apologies for the inconvenience.
>>
>>      cheers,
>>        DaveK
>>
>>    
>
>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 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.

cgf

--
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