Browse Source

Set the load directory as dll directory.

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

8
Emgu.CV/PInvoke/CvInvoke.cs

@ -305,8 +305,14 @@ 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
System.Diagnostics.Debug.WriteLine(String.Format("Loading open cv binary from {0}", loadDirectory));

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