diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-01-17 15:40:15 +0100 |
|---|---|---|
| committer | j-p <jp_bruyere@hotmail.com> | 2021-02-06 20:28:02 +0100 |
| commit | e7da508d07c90eb62fedc765db0e9b67b58b92ca (patch) | |
| tree | 271c06b6c16a3989e55fc6caa6539dc62b58b4f9 /Samples/PerfTests/Program.cs | |
| parent | 0299b2c358f322a4ff012dbc8f9989dfe7cc3d2a (diff) | |
add netcore NativeResolve for PerfTests
Diffstat (limited to 'Samples/PerfTests/Program.cs')
| -rw-r--r-- | Samples/PerfTests/Program.cs | 20 |
1 files changed, 20 insertions, 0 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; |