title: Error when loading .dll from a different directory using python ctypes.CDLL()
body: <p>I have to following directory structure:  </p>
  
  <pre><code>MainProject  
      |    ...project files  
      |    rtlsdr\  
      |    |    rtlsdr.dll
      |    |    ...other .dll's etc.  
  </code></pre>
  
  <p>I am using the function <em>CDLL()</em> in the library <em>ctypes</em> to load <code>rtlsdr.dll</code>. It works fine when my working directory is <code>rtlsdr\</code>:</p>
  
  <pre><code>$ cd rtlsdr
  $ python
  &gt; from ctypes import *
  &gt; d = CDLL('rtlsdr.dll')
  </code></pre>
  
  <p>However, when I try to load the file from another directory:  </p>
  
  <pre><code>$ cd MainProject
  $ python
  &gt; from ctypes import *
  &gt; d = CDLL('rtlsdr\\rtlsdr.dll')
  </code></pre>
  
  <p>I get an error:  </p>
  
  <pre><code>WindowsError: [Error 126] The specified module could not be found.
  </code></pre>
  
  <p>What is the problem here?</p>