I have modified the Adriano dos Santos Fernandes patchset somewhat so that it can be used with both cygwin and mingw, changing "mingw" to "w32" in symbol names and taking out changes to the mingw runtime and put in gcc runtime. Instead of calling __w32_initialize_shared_ptr from __main, it is called by a constructor from crtend.o so it happens at same time as registration of eh_frame. The w32-shared-ptr.c code ends up in a startup module I have called crts.o. I have put into startup module, rather than a runtime library to ease testing without having to change the target-specific runtime. It also adds flexibility by allowing this code (and the crtbegin/crtend modules) to be excluded in future by using -fno-exceptions switch in specs. If the initialize_shared_ptr code is to stay integrated with the gcc build, we could changes the global int variables used to find offsets i.e. +const int __w32_sharedptr_terminate = 1; +const int __w32_sharedptr_unexpected = 2; +const int __w32_sharedptr_unseen_objects = 3; +const int __w32_sharedptr_seen_objects = 4; +#define SHAREDPTR_COUNT 5 into enum, defined in a gcc config header, to allow some optimization in determining the offsets. But I do need some advise on all this, particulary since the use of Find/AddAtom may not be necessary for cygwin (see below). One other change I have made from Adriano's initial patch is to set default terminate and uncaught_exception handlers to abort. This isn't quite right: the default uncaught_exception handler should be the current std::terminate function, but that can be fixed later. I am happy with tests on mingw, still testing on cygwin. I believe with cygwin that much of this could be simplified and the global data could just be put into cygwin1.dll, but one thing at a time. Please review attached diff. In addition to any technical improvements to code, I also need feedback on the larger issue of whether to make this mingw-specific or common to cygwin and mingw. Danny http://digital.yahoo.com.au - Yahoo! Digital How To - Get the best out of your PC!
Sign up for the SourceForge newsletter:No, thanks