title: Unable to load DLL: The specified module could not be found
body: <p>I am getting what seems to be a common issue in my C# program.</p>
  
  <p>I have been looking online in many places and tring different solutions. ALl of whihc have so far failed.</p>
  
  <p>I came across this post and tried their solution which did not work:
  <a href="https://stackoverflow.com/questions/16479139/unable-to-load-dll-the-specified-module-could-not-be-found">Unable to load DLL The specified module could not be found</a></p>
  
  <p>I downloaded dependancy walked to see if I was missing any other dlls which, it is reporting that I am but those dlls are the win-API dlls. Which according this link: <a href="https://social.msdn.microsoft.com/Forums/en-US/a28331ae-19a3-4a34-b3ba-1e8fd4430375/missing-apimswincore-dlls" rel="nofollow noreferrer">https://social.msdn.microsoft.com/Forums/en-US/a28331ae-19a3-4a34-b3ba-1e8fd4430375/missing-apimswincore-dlls</a>, it doesn't matter if dependency walker reports those as missing.</p>
  
  <p>I have also downloaded and installed the VC++ redistribute 2015 x64 and x86 and I am still recieving the same error.</p>
  
  <p>There was another post that recommended that I install the windows SDK. I did this for windows 10 and again, still the same error.(<a href="https://stackoverflow.com/questions/7568697/missing-dlls-on-64-bit-win?rq=1">Missing dlls on 64 bit Win</a>).</p>
  
  <p>I have even tried placing the dll in system32 folder but again, no issue</p>
  
  <p>I am running out of ideas on how to solve it so if anyone else ran into the same issue, any help would be appreciated.</p>
  
  <p>For those wondering, I am developing on win 10 using VS2015.</p>
  
  <p>EDIT:</p>
  
  <p>The name of the DLL that I am using is called: SLABHIDtoUART.dll</p>
  
  <p>My code for importing the functions is a as follows:</p>
  
  <pre><code>[DllImport("SLABHIDtoUART.dll")]
          public static extern int HidUart_GetNumDevices(ref uint numDevices, ushort vid, ushort pid);
  </code></pre>
  
  <p>Here is the exact error:</p>
  
  <pre><code>System.DLLNotFoundException: Unable to load DLL 'SLABHIDtoUART.dll': The specified module could not be found (Exception from HRESULT: 0x8007007E)
  </code></pre>
  
  <p>Oh and I did change the compiler settings in VS from Any CPU to x86. Technically, I did not have that as an option by default and I needed to add a new option for the x86. After a recompile with the x86 compiler, the program still doesn't seem to be working.</p>
  
  <p>I even moved all of the DLLs that the SLAB dll depends on and ran the program and the program still did not run. (SLAB dll depend on hid.dll, setupapi.dll, and kernal32.dll)</p>