dlclose not calling destructors of static variables.

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


On Mon, Feb 01, 2010 at 10:36:38PM +0000, Dave Korn wrote:
>On 01/02/2010 21:59, Christopher Faylor wrote:
>>Since the testcase (obviously?) worked for me it seems like this is
>>pretty variable.  I'd like to understand why the
>>MEMORY_BASIC_INFORMATION method doesn't work before trying other
>>things.
>
>Hmm, well first off, looks like RegionSize is indeed relative to
>BaseAddress, not AllocationBase after all:

Yes, I got that from the report in the cygwin list.  The first thing I
did on seeing that was look up MSDN.

Looking at the memory layout in gdb and in linker scripts, it seems like
using data_end or bss_end should not be necessary.  Just checking from
AllocationBase -> BaseAddress.RegionSize should be adequate.

However, I think your other idea has more merit.  Inspecting the return
address, calling __cxa_atexit for registered dlls, and calling
__cxa_finalize when the dll is detaching seems to work pretty well.

I'm submitting the below but I have an accompanying newlib patch to go
with it which should address the locking concerns.

http://cygwin.com/ml/cygwin-cvs/2010-q1/msg00065.html

cgf



More information about the Cygwin-patches mailing list