title: Load 2 versions of the same DLL in the same process
body: <p>I want to do exactly what it is described <a href="https://stackoverflow.com/questions/4385806/determine-the-loaded-path-for-dlls">here</a>, but the accepted solution does not work for me. I suppose the reason is explained <a href="http://msdn.microsoft.com/en-us/library/ms682586(v=vs.85).aspx" rel="nofollow noreferrer">here</a> :</p>
  
  <blockquote>
    <p>If a DLL with dependencies is loaded
    by specifying a full path, the system
    searches for the DLL's dependent DLLs
    as if they were loaded with just their
    module names.</p>
    
    <p>If a DLL with the same module name is
    already loaded in memory, the system
    checks only for redirection and a
    manifest before resolving to the
    loaded DLL, no matter which directory
    it is in. The system does not search
    for the DLL.</p>
  </blockquote>
  
  <p>I wish to have my application in the following structure.</p>
  
  <pre><code>c:\Exe
   |
   |----- c:\DLL\DLL.dll, c:\DLL\common.dll 
   |
   |----- c:\DLL2\DLL2.dll, c:\DLL2\common.dll
  </code></pre>
  
  <p>My EXE will load the DLLs through</p>
  
  <pre><code>LoadLibrary("c:\\DLL\\DLL.dll");
  LoadLibraryEx("c:\\DLL2\\DLL2.dll");
  </code></pre>
  
  <p>common is implicitly loaded in both cases.</p>
  
  <p>I tried the SetDllDirectory option, but there is always only one common.dll loaded.</p>
  
  <p>I added version information in common.dll. c:\DLL\common.dll has version 2.0.1.0 while c:\DLL2\DLL2.dll has version 4.0.1.0</p>
  
  <p>I embedded the following manifest with the corresponding version info, but it did not help.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"&gt;
    &lt;dependency&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity type="win32" name="common" version="4.0.1.0" processorArchitecture="x86"&gt;&lt;/assemblyIdentity&gt;
      &lt;/dependentAssembly&gt;
    &lt;/dependency&gt;
  &lt;/assembly&gt;
  </code></pre>
  
  <p>Is there a solution to this problem ?</p>