Mladen Turk wrote: > William A. Rowe, Jr. wrote: >> I thought the concensus was that the MSVC's own destructor callbacks >> were more interesting, since they would permit apr to be statically >> bound to the app? >> > > I have tried the think Brane mentioned. > Even contacted the original author of the article > from Codeguru (Jac Goudsmit), and it works, but only > for WIN32 flatform. Building for AMD64 fails with > things like: > > MSVCRTD.lib(crtexe.obj) : warning LNK4078: multiple '.CRT' sections > found with different attributes (40400040) > MSVCRTD.lib(cinitexe.obj) : warning LNK4254: section '.CRT' (C0000040) > merged into '.rdata' (40000040) with different attributes > > ... and it doesn't work although builds with warnings. > I have contacted Jac to see if he has some ideas why this > doesn't work on non x86 CPU's, but I'm skeptic because those > link warning says that for AMD64 those segments are read only, > and thus you can not insert your own handler.
I know that boost_thread uses this method, and I've verified that it works on AMD64 and IA64; the tric is, I believe, that Boost inserts a single static handler into the static constructor and destructor segments, and lets that handler maintain its own list of hooks. -- Brane
