HDF5.dll Matlab MCR v9.1 和我的应用程序之间存在版本冲突
HDF5.dll version conflict between Matlab MCR v9.1 and my application
MyApp 是一个 C# .NET v4.5.2 WPF 应用程序。 MyAssembly 是我创建的包含 MyClass 的 Matlab .NET 程序集。 MyAssembly 需要 MCR v9.1。 MyApp 执行各种任务;当需要 Matlab 并尝试实例化 MyClass 时,弹出 window 显示:
The procedure entry point H5Rdereference could not be located in dynamic link library C:\Program Files\MATLAB\MATLAB Runtime\v91\bin\win64\libmat.dll.
MyApp 包含一个版本的 hdf5.dll(从 Nuget 包 HDF.PInvoke v1.10.1 获得),我发现 MCR 9.1 也包含一个(不同的)版本的 hdf5.dll C:\程序Files\MATLAB\MATLABRuntime\v91\bin\win64。当我用 MCR 9.1 版本替换该 dll 的 MyApp 版本时,MyApp 能够实例化 MyClass,但随后 MyApp 不再能够执行其 HDF5 任务;调用 H5.open() 抛出:
Unable to load DLL 'hdf5.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
MyClass 不需要 HDF5,那么为什么 MCR 加载它的那个 DLL 副本?
我该如何解决这个冲突?
更新 1:我将所有 MyApp 的非 Matlab 相关的 HDF5 使用移动到一个单独的应用程序域中,但问题仍然存在。就好像 HDF5.dll 正在加载到主应用程序域中,即使加载它的代码是在单独的应用程序域中执行的。
HDF5.dll 是本机 DLL,因此不受 AppDomain 边界的约束。
MyApp 是一个 C# .NET v4.5.2 WPF 应用程序。 MyAssembly 是我创建的包含 MyClass 的 Matlab .NET 程序集。 MyAssembly 需要 MCR v9.1。 MyApp 执行各种任务;当需要 Matlab 并尝试实例化 MyClass 时,弹出 window 显示:
The procedure entry point H5Rdereference could not be located in dynamic link library C:\Program Files\MATLAB\MATLAB Runtime\v91\bin\win64\libmat.dll.
MyApp 包含一个版本的 hdf5.dll(从 Nuget 包 HDF.PInvoke v1.10.1 获得),我发现 MCR 9.1 也包含一个(不同的)版本的 hdf5.dll C:\程序Files\MATLAB\MATLABRuntime\v91\bin\win64。当我用 MCR 9.1 版本替换该 dll 的 MyApp 版本时,MyApp 能够实例化 MyClass,但随后 MyApp 不再能够执行其 HDF5 任务;调用 H5.open() 抛出:
Unable to load DLL 'hdf5.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
MyClass 不需要 HDF5,那么为什么 MCR 加载它的那个 DLL 副本? 我该如何解决这个冲突?
更新 1:我将所有 MyApp 的非 Matlab 相关的 HDF5 使用移动到一个单独的应用程序域中,但问题仍然存在。就好像 HDF5.dll 正在加载到主应用程序域中,即使加载它的代码是在单独的应用程序域中执行的。
HDF5.dll 是本机 DLL,因此不受 AppDomain 边界的约束。