I’ve come across an odd situation and my (supposed) knowledge of code linkage is failing me…
I have come across a bug that only occurs in a 64-bit build with optimizations turned on (/O2, /O3, or /Ox). The bug occurs in an executable that is not performance critical and we have to give a demo of a prototype very soon (i.e., Monday). Due to the extreme pressure to get this working for the demo, I had an idea; build the static library (which is performance critical) with optimizations on and turn them off in the executable. This should hide the bug until I fix it while not slowing down the system, or so I thought.
I have now tried this with Link Time Code Generation off, as well as on, and no whole program optimization, but each time, with the VS2005 C++ compiler as well as when using Intel’s compiler, the performance critical library is not being linked in with optimizations enabled and things slow down dramatically.
Does anyone know how to accomplish what I am after here? This is an odd situation and I have never had to deal with it, but I did some reading and I couldn’t find any documentation saying that what I am trying to accomplish isn’t feasible, but apparently it is not or I am missing something. Thanks in advance for any help you guys can offer, I know this is an odd request for a dirty short term “fix”, but it is rather important.
Your problem is almost assuredly that critical inlining of functions in your library or the standard library is being disabled in the final application by turning off optimizations.