Browse Source

Set the load directory as dll directory.

pull/348/head
Canming Huang 5 years ago
parent
commit
f917cdaaac
  1. 6
      Emgu.CV/PInvoke/CvInvoke.cs
  2. 3
      Emgu.Util/Toolbox.cs

6
Emgu.CV/PInvoke/CvInvoke.cs

@ -305,7 +305,13 @@ namespace Emgu.CV
String oldDir = Environment.CurrentDirectory;
if (!String.IsNullOrEmpty(loadDirectory) && Directory.Exists(loadDirectory))
{
Environment.CurrentDirectory = loadDirectory;
if (Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.Windows)
{
bool setDllDirectorySuccess = Emgu.Util.Toolbox.SetDllDirectory(loadDirectory);
}
}
#endif

3
Emgu.Util/Toolbox.cs

@ -548,8 +548,9 @@ namespace Emgu.Util
{
const int loadLibrarySearchDllLoadDir = 0x00000100;
const int loadLibrarySearchDefaultDirs = 0x00001000;
const int loadLibrarySearchApplicationDir = 0x00000200;
//const int loadLibrarySearchUserDirs = 0x00000400;
IntPtr handler = LoadLibraryEx(dllname, IntPtr.Zero, loadLibrarySearchDllLoadDir | loadLibrarySearchDefaultDirs);
IntPtr handler = LoadLibraryEx(dllname, IntPtr.Zero, loadLibrarySearchDllLoadDir | loadLibrarySearchDefaultDirs | loadLibrarySearchApplicationDir );
//IntPtr handler = LoadLibraryEx(dllname, IntPtr.Zero, loadLibrarySearchUserDirs);
if (handler == IntPtr.Zero)
{

Loading…
Cancel
Save