title: Is there a best practice of loading a DLL from within another DLL?
body: <p>I need to load a DLL from within another DLL. The temptation is to load it in DllMain, but there is already convincing documentation which says that it is a "bad idea".</p>
  
  <p>At the risk of asking a question that is not very specific: Is there a best practice of loading a DLL from another DLL?</p>
  
  <p>In our current project, our main DLL has a class. I load the second DLL from the constructor of that class. However, since that class can be instantiated multiple times in the DLL, I keep a variable around that indicates whether the DLL was previously loaded in order not to call LoadLibrary again. This somehow doesn't feel like it is a good solution, hence my question.</p>