From: Jean-Philippe Bruyère Date: Sun, 17 Jan 2021 14:40:15 +0000 (+0100) Subject: add netcore NativeResolve for PerfTests X-Git-Tag: v0.9.5-beta~99 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=e7da508d07c90eb62fedc765db0e9b67b58b92ca;p=jp%2Fcrow.git add netcore NativeResolve for PerfTests --- 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