Skip to content

Commit

Permalink
Fixed that CRT and ffmpeg are unloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
shimat committed May 23, 2014
1 parent f0ebe87 commit 2d8d873
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
7 changes: 4 additions & 3 deletions nuget/OpenCvSharp-AnyCPU.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>OpenCvSharp-AnyCPU</id>
<version>2.4.8.20140522</version>
<version>2.4.8.20140523</version>
<title>OpenCvSharp</title>
<authors>shimat</authors>
<licenseUrl>http://www.gnu.org/licenses/lgpl-3.0.en.html</licenseUrl>
<projectUrl>https://github.com/shimat/opencvsharp</projectUrl>
<iconUrl>https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/Girl.jpg</iconUrl>
<iconUrl>https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/lenna-icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>OpenCV wrapper for .NET Framework</description>
<releaseNotes>- Changed platform-specific build to AnyCPU build</releaseNotes>
<releaseNotes>- Changed platform-specific build to AnyCPU build
- fixed that CRT and ffmpeg are unloaded</releaseNotes>
<copyright>Copyright 2008-2014</copyright>
<tags>Image Processing OpenCV Wrapper FFI</tags>
<frameworkAssemblies>
Expand Down
19 changes: 18 additions & 1 deletion src/OpenCvSharp/Src/PInvoke/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ public static class NativeMethods
private static bool? hasQt;

#region DLL File Name

public const string Version = "248";

public const string DllMsvcr = "msvcr110";
public const string DllMsvcp = "msvcp110";

public const string DllCalib3d = "opencv_calib3d" + Version;
public const string DllCore = "opencv_core" + Version;
public const string DllFeatures2d = "opencv_features2d" + Version;
Expand All @@ -54,6 +58,9 @@ public static class NativeMethods
public const string DllPhoto = "opencv_photo" + Version;
public const string DllVideo = "opencv_video" + Version;

public const string DllFfmpegX86 = "opencv_ffmpeg" + Version;
public const string DllFfmpegX64 = DllFfmpegX86 + "_64";

#endregion

#region Static constructor
Expand Down Expand Up @@ -98,6 +105,11 @@ public static void LoadLibraries()
if (IsUnix())
return;

// msvcr:
WindowsLibraryLoader.Instance.LoadLibrary(DllMsvcr);
// msvcp: msvcr
WindowsLibraryLoader.Instance.LoadLibrary(DllMsvcp);

// core:
WindowsLibraryLoader.Instance.LoadLibrary(DllCore);
// flann: core
Expand All @@ -121,6 +133,11 @@ public static void LoadLibraries()
WindowsLibraryLoader.Instance.LoadLibrary(DllCalib3d);
// legacy: core, flann, imgproc, highgui, features2d, calib3d, ml, video
WindowsLibraryLoader.Instance.LoadLibrary(DllLegacy);

if (IntPtr.Size == 4)
WindowsLibraryLoader.Instance.LoadLibrary(DllFfmpegX86);
else if (IntPtr.Size == 8)
WindowsLibraryLoader.Instance.LoadLibrary(DllFfmpegX64);
}

/// <summary>
Expand Down

0 comments on commit 2d8d873

Please sign in to comment.