Watch
2
0
Fork
You've already forked raylib-cs
0

Update tests and dll resolver

This commit is contained in:
Rgebee 2026-05-17 19:18:50 +01:00
commit eb48e471d8
5 changed files with 45 additions and 94 deletions

View file

@ -26,25 +26,27 @@ public static unsafe partial class Raylib
static Raylib()
{
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), (libraryName, assembly, searchPath) =>
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), ResolveDllImport);
}
public static IntPtr ResolveDllImport(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
{
IntPtr handle = IntPtr.Zero;
string libraryPath = GetLibraryPath(libraryName);
if (NativeLibrary.TryLoad(libraryName, assembly, searchPath, out handle))
{
IntPtr handle = IntPtr.Zero;
string libraryPath = GetLibraryPath(libraryName);
return handle;
}
if (NativeLibrary.TryLoad(libraryPath, out handle))
{
return handle;
}
if (NativeLibrary.TryLoad(libraryPath, out handle))
{
return handle;
}
if (NativeLibrary.TryLoad(libraryName, assembly, searchPath, out handle))
{
return handle;
}
throw new DllNotFoundException(
$"Failed to load {libraryName} using {libraryPath}."
);
});
throw new DllNotFoundException(
$"Failed to load {libraryName}."
);
}
public static string GetLibraryPath(string libraryName)