This is the mail archive of the
mailing list for the Cygwin project.
Re: dlclose not calling destructors of static variables.
- From: Andrew West <andrewwest at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 01 Feb 2010 17:35:10 +0000
- Subject: Re: dlclose not calling destructors of static variables.
- References: <4B61732F.email@example.com> <4B62DDE6.firstname.lastname@example.org> <4B62F118.email@example.com> <20100129184514.GA9550@ednor.casa.cgf.cx> <4B66BF2F.firstname.lastname@example.org> <20100201162603.GB25374@ednor.casa.cgf.cx>
On 01/02/2010 16:26, Christopher Faylor wrote:
Could you clarify? Are you saying that your test case still failed?
With the change you provided my test still failed, but changing
m.AllocationBase to m.BaseAddress it worked.
Unfortunately it only worked for that test cash, on trying it with a
full program of mine it crashed using both
AllocationBase and BaseAddress to work out the start position of the dll.
On closer examination it looks like dll_beg <-> dll_end doesn't cover
all the possible locations that atexits are registered from.
I think RegionSize isn't big enough at least when I compare them to gdbs
"info sharedlibrary", for example:
m.AllocationBase = 0x706c0000
m.AllocationBase + m.RegionSize = 0x706c1000
from = 0x706c1000
to = 0x706c717c
But the atexit function is registered at 0x706c10f0. Changing
AllocationBase to BaseAddress worked for my test case out of pure luck,
with my larger libraries it still failed.
Looking at one of the libraries in my code that fails I get ( with the
atexit at 0x78351c9 )
m.AllocationBase = 0x7820000
m.AllocationBase + m.RegionSize = 0x7824000
from = 0x07821000
to = 0x079159b8
With both of these examples I checked the dll using objdump and the
atexit functions where in the .text portion but RegionSize never seems
big enough to cover it entirely. For that last dll objdump reports the
text size as 61380. Of course I could be reading objdump wrong, I've
only every really used it to check exported functions.
Cribbing from the gdb source code, it looks like they use BaseAddrees +
0x1000 for the start point and then call GetModuleInformation to workout
the size of the module. I'm currently trying this out in dll_init.cc but
for some reason GetCurrentProcess is returning -1 for me :(
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple