On 9/14/2011 4:48 PM, Christopher Pisz wrote:
I've googled for a few hours and seen people mention something to the effect of "you cannot call join from DllMain" and "while DLL is unloading", but no explanation or alternative.
How would I go about fixing this problem? I don't think I can guarentee noone will ever make a global instance of my class....
As I recall, the DLLMain's as well as process startup code in the main EXE is called with a process mutex, so threads cannot be started until the normal main is called. Likewise at shut-down, but I don't know what happens to other threads. I suspect they are halted before the unloading process begins. Once your main() returns, at some point threads are halted so ensure that threading is done before that! I assume you mean the DLL is unloading because the process is terminating. I don't know if that's still the case for dynamic LoadLibrary.