This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
RE: pthreads VCE: problem with destructor
- From: "Gardian, Milan" <Milan dot Gardian at LEIBINGER dot com>
- To: Mike Kinghan <Mike_Kinghan at systemsunion dot com>, "Pthreads-Win32 at Sources dot Redhat dot Com" <pthreads-win32 at sources dot redhat dot com>
- Cc: "Ross Johnson (E-mail)" <rpj at ise dot canberra dot edu dot au>, "John Bossom (E-mail)" <John dot Bossom at Cognos dot COM>
- Date: Wed, 19 Dec 2001 13:03:52 +0100
- Subject: RE: pthreads VCE: problem with destructor
Hi Mike,
> Yeah, I have encountered similar problems. I presume
> you are using MS VC++ 6.0 and that these disappearing
> destructors affect your release build but not your
> debug build?
Just wanted to let you know that the problem occurs in debug build as well.
I tried two things:
1. the pthreads distribution, compiled using the command-line VC++
compiler/linker (that contains the full debug info, no optimisations) ->
added a test 'exit4.c' that fails, as described in my previous mail
2. pthreads library compiled from VC++ GUI environment (pthreads.dsp + a
test project). This was a bit more complex than the 'exit4.c' test but also
failed - in both debug (no optimisations) and release builds
I eventually tracked the problem down to
extern "C"
versus
extern
function declaration+definition. If the exception is thrown from a function
that was exported as extern "C" from the DLL, destructor is not called
(stack rollback is not performed). On the other hand if the exception is
thrown from a function exported as extern (C++ name mangling and co.), there
is no problem at all (full stack rollback -> destructor call).
Anyway I liked the contribution from John Bossom and will support the
removal of VCE version of pthreads from the library as suggested by Ross
Johnson. I think the C++ stuff introduces more problems than it fixes...
Cheers,
Milan