Let me describe the problem which I encountered working in a project for one of my customers. Let's start with a...
This is only a short technical note - for those who (like me) first check the Internet for solution to weird programming questions!
Well, the same happened to me when I was porting a C++ application from Visual Studio 2008 to VS 2010. To be honest, the situation was a little more complicated: a mixed mode C++/C# program using C++/CLI as a glue. But back to the problem: the standard explanation for that ASSERT is that you have forgotten to include the AFX_MANAGE_STATE macro thanks in advance. (Reason 1) in exported DLL functions as described here.
Sadly, this wasn't my problem. It applies to non-MFC DLLs only**, which mine wasn't, so the whole module state management business should be cared automatically in DLL initalization code the linker is generating. This again is controlled by #define macros used whith the compiler (like _USRDLL, _AFXDLL and their hellish likes). So maybe this could be the reason? Nope, everything was correct :-(.
After more web-searching and finding only tons of happless cries for help I stumbled upon the 2nd useful link