title: Limitation on usages of global variables in DLL (for Windows)
body: <p>First of all, I know global variables are evil :) However, there is legit case why I need to use one.</p>
  
  <p>I know that there are very strict limitation on what can be executed in DllMain (no LoadLibraries, no COM initialization and so on).</p>
  
  <p>And I know that global variables are initialized just prior DllMain DLL_PROCESS_ATTACH.</p>
  
  <p>Do I have the same limitation while global variable initialization? </p>
  
  <p>I found Microsoft article: <a href="http://msdn.microsoft.com/en-us/library/988ye33t" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/988ye33t</a>
  However, it doesn't have any details related to the limitations.</p>
  
  <p>I saw also another Stackoverflow questions: <a href="https://stackoverflow.com/questions/75701/what-happens-to-global-variables-declared-in-a-dll">What happens to global variables declared in a DLL?</a>
  Here is snippet from there "There are things that are forbidden to do in the DllMain. Those things are <strong>probably</strong> forbidden, too, in the constructors." </p>
  
  <p>However, it looks like commentor isn't sure whether such limitations are really exist.</p>
  
  <p>I would appreciate any information on this subject.</p>