title: LoadLibrary() error code 1008
body: <p>I want to load a C++ dll in C# (VS2012, C++ dll also created in VS2012 C++) that in C++ dll I've used a shared library generated by MATLAB with using of deploytool.(My configuration in both C# and C++ programs is x64 and shared library also generated in 64-bit version of MATLAB).<br>
  I've used following codes to load library and then I've recieved error code 1008 :  </p>
  
  <pre><code>[DllImport("kernel32.dll",CharSet = CharSet.Auto, SetLastError = true)]
  private static extern IntPtr LoadLibrary(string libname);
  ...
  IntPtr handle = LoadLibrary("libName.dll");
  if(handle == IntPtr.Zero)
  {
     int errorCode = Marshal.GetLastWin32Error();
     //at this point error code will be 1008.
  }
  </code></pre>
  
  <p>Help me to resolve that, please!<br>
  Thanks in advance.</p>