William A. Rowe, Jr. wrote: > Branko Čibej wrote: > >> I've recently learned of a trick that would make this work anywhere, >> even in a static lib, and wouldn't need DllMain. You can actually insert >> your own constructors and destructors into the CRT's tables. >> > > Two questions - does this include per-thread on thread exit destruction, and > how much variance is there from crt to crt? I'm particularly worried since > more and more code is built with mixed crts, e.g. a 2003 and a 2005 runtime. > Yes, there are per-thread tables, and I've tested this with MSVC5, 6 and VS2005 (the latter also on AMD64 and Itanium). I don't think the format of these tables can change without a radical modification of the Windows ABI, because the loader actually invokes those c/dtors, not the CRT.
-- Brane
