On 15/12/2011 17:44, Mike Stump wrote: > On Dec 15, 2011, at 1:43 AM, Kai Tietz wrote: >> This patch takes care that we are using for operator new/delete >> replacement test static version on mingw-targets. As the shared (DLL) >> version isn't able to have operator overload within DLL itself, as a DLL >> is finally-linked for PE-COFF. > >> Ok for apply? > > Not sure who would review this if I don't, so, Ok. That said, if a shared > library C++ type person wants to chime in... I get the feeling this is > unfortunate, and it might have been nice to manage this in some other way, > but, I just want to step back and let others think about it.
Well, it's a consequence of how you can't leave undefined references in Windows DLLs at link-time for the loader to just fill in with the first definition it comes across at run-time (as you can on ELF). We have to jump through hoops to get operator new/delete replacement working on Cygwin, and were lucky in that the cygwin1.dll is linked against absolutely everything, so we had somewhere to hang our redirection hooks. Without someone adding some similar amount of infrastructure to MinGW, the only time function replacement can work is for a statically-linked executable, when all definitions are visible in one single link. > * g++.old-deja/g++.brendan/new3.C: Adjust test for mingw > targets to use static-version. s/static-version/static linking/ > +// Avoid use of none-overridable new/delete operators in shared s/none-overridable/non-overridable/g s/in shared/in shared link/g Patch looks perfectly sensible to me, but I can't approve. cheers, DaveK