Ok, now sersiously...
Today I spent a reasonable time debugging some strange behaviour of an application that I'm working on.
It's got several dependencies and amongst them .... Lua .... (or shall I say Cthlua
For some weird reason, the application would run fine on the pc that it was build on, as well as on every pc that had Visual Studio installed.
Without Visual Studio beeing installed, the application would just crash with the well known "The Application failed to initialize properly ( 0xc0150002 )" message.
After at least one hour and 3 failed attempts to debug/solve the problem I stumbled across the so called "Windows Event Logger", while doing the thousandth google search containing "0xc0150002" + some other keywords.
Up to this moment, I would never have thought that the Event Logger would tell something useful to guys, who are debugging their own applications.
But I nonetheless opened the Logger and what I found there was something like that:
Generate Activation Context failed for c:\whatever\path\myDll.dll. Reference error message: The referenced assembly is not installed on your system.
Since the appropriate VC Runtime was installed on the system(s) I quite quickly came to the conclusion that one of the dependencies of myDll had to cause the trouble.
So I started to rule them out one by one, until I arrived at Lua, once I removed the linking to Lua, everything became peanut butter-jelly bread again (meaning: "it started working again").
Further investigation on the Lua binaries (that I've built myself and therefore shouldn't be linked to a different VC runtime version), revealed that Cthlua, the worst of all the great old ones, used the same output names for both it's Release and Debug builds, namely lua5.1.lib.
So in essence I linked the Release build of my application to the Debug build of a Lua library and (of course) the VC runtime was not amused about this fact.
So what do we learn from this little horror story of mine...
- Do know your Windows Event Logger, it sometimes has got useful information for the desperate.
- Microsoft's VC Runtime Mumbo-Jumbo can really harm your application (silently) if you aren't aware.
- And most importantly, be aware of the great Cthlua, with it's tentacle butt and it's inconsistent binary naming

Maybe with VS2010 things will become better again, at least I hope so.
/start VC Runtime flaming here
Cheers
