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

Make the custom dll import resolver optional

This commit is contained in:
Chris 2026-08-28 07:45:14 +01:00
commit 0b6ff007c7

View file

@ -24,18 +24,6 @@ public static unsafe partial class Raylib
public const float DEG2RAD = MathF.PI / 180.0f;
public const float RAD2DEG = 180.0f / MathF.PI;
static Raylib()
{
// On WebAssembly (browser) the native library is statically linked into the main
// module, and P/Invokes are resolved by the runtime's built-in static-linking table.
// A custom resolver would override that and fail (there is no library to load), so we
// only install it on platforms where raylib is a separate dynamic library.
if (!OperatingSystem.IsBrowser())
{
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), ResolveDllImport);
}
}
public static IntPtr ResolveDllImport(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
{
IntPtr handle = IntPtr.Zero;