Skip to content

Commit

Permalink
Fix warnings when the internal library loader fails to find a library
Browse files Browse the repository at this point in the history
  • Loading branch information
exelix11 committed Jan 4, 2024
1 parent b68349f commit b923f06
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions Client/Platform/DynamicLibraryLoader.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
using FFmpeg.AutoGen;
using SDL2;
using SysDVR.Client.Core;
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.Arm;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace SysDVR.Client.Platform
{
Expand Down Expand Up @@ -121,8 +112,12 @@ static IntPtr CachedLibraryloader(string libraryName, Assembly assembly, DllImpo

var loaded = TryLoadLibrary(libraryName);

if (loaded != IntPtr.Zero)
LibraryCache.TryAdd(libraryName, loaded);
if (loaded == IntPtr.Zero && Program.Options.Debug.DynLib)
Console.WriteLine($"CachedLibraryloader failed to resolve {libraryName}");

// Cache the failure so we don't try again
// Dotnet will try to load the library again using its own resolver if we return IntPtr.Zero
LibraryCache.TryAdd(libraryName, loaded);

return loaded;
}
Expand Down Expand Up @@ -174,7 +169,6 @@ public static IntPtr TryLoadLibrary(string libraryName)
return TryLoadLibrary(withoutNumber);
}

Console.WriteLine($"Failed to load {libraryName}");
return IntPtr.Zero;
}

Expand Down

0 comments on commit b923f06

Please sign in to comment.