From e7da508d07c90eb62fedc765db0e9b67b58b92ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Sun, 17 Jan 2021 15:40:15 +0100 Subject: [PATCH] add netcore NativeResolve for PerfTests --- Samples/PerfTests/Program.cs | 20 ++++++++++++++++++++ Samples/common/ui/Interfaces/Divers/2.crow | 11 +++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Samples/PerfTests/Program.cs b/Samples/PerfTests/Program.cs index 73b97448..a50003f6 100644 --- a/Samples/PerfTests/Program.cs +++ b/Samples/PerfTests/Program.cs @@ -6,11 +6,31 @@ using System.CodeDom.Compiler; using System.Diagnostics; using System.IO; using Crow; +using System.Reflection; +using System.Runtime.InteropServices; namespace PerfTests { class TestInterface : Interface { +#if NETCOREAPP + static IntPtr resolveUnmanaged (Assembly assembly, String libraryName) { + + switch (libraryName) + { + case "glfw3": + return NativeLibrary.Load("glfw", assembly, null); + case "rsvg-2.40": + return NativeLibrary.Load("rsvg-2", assembly, null); + } + Console.WriteLine ($"[UNRESOLVE] {assembly} {libraryName}"); + return IntPtr.Zero; + } + + static TestInterface () { + System.Runtime.Loader.AssemblyLoadContext.Default.ResolvingUnmanagedDll+=resolveUnmanaged; + } +#endif readonly int count = 1, updateCycles = 0; readonly bool miliseconds = false; readonly bool resetItors = false; diff --git a/Samples/common/ui/Interfaces/Divers/2.crow b/Samples/common/ui/Interfaces/Divers/2.crow index d2c8c370..a1896248 100644 --- a/Samples/common/ui/Interfaces/Divers/2.crow +++ b/Samples/common/ui/Interfaces/Divers/2.crow @@ -2,13 +2,8 @@ - \ No newline at end of file -- 2.47.3