This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: dlclose not calling destructors of static variables.
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Mon, 1 Feb 2010 21:03:13 -0500
- Subject: Re: dlclose not calling destructors of static variables.
- References: <20100129184514.GA9550@ednor.casa.cgf.cx> <4B66BF2F.4060802@gmail.com> <20100201162603.GB25374@ednor.casa.cgf.cx> <4B6710CE.40300@gmail.com> <20100201174611.GA26080@ednor.casa.cgf.cx> <20100201175123.GB26080@ednor.casa.cgf.cx> <4B672B74.4090808@gmail.com> <4B6736C1.8030101@gmail.com> <20100201215919.GA29662@ednor.casa.cgf.cx> <4B675776.4020105@gmail.com>
- Reply-to: cygwin-patches at cygwin dot com
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