Vixen
02b45cc4
csharp
public static class SdlLibrary

Finding SDL, and saying something useful when it is not there.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Silk.NET.SDL is bindings and nothing else — no native binary ships with the package (verified: it has no .Native companion on nuget.org, unlike most of Silk.NET's bindings). So libSDL2 comes from the application's own runtimes/<rid>/native/ layout or from the system, in that order, which is what NativeLibraries decides.

Sdl.GetApi() is not called, for the same reason VulkanLoader stopped calling Vk.GetApi(). It builds Silk.NET's default context, which finds a native library through Assembly.Location and DependencyContext.Default — neither of which exists in a NativeAOT binary, and both of which ILC reports as IL3000/IL3002. Loading the library here and handing Silk a context over the handle keeps that code out of the graph entirely rather than suppressing what it says. See R11.

The default failure is a DllNotFoundException naming a file, which tells a developer nothing about what to do. Load replaces it with the command for their platform, and TryLoad lets a test skip instead of failing on a machine that was never going to be able to run it.

Fields and properties (1)

  • public static bool IsAvailable

    Whether SDL could be found and loaded.

Methods (2)

  • public static Sdl Load()

    Loads SDL, or explains how to install it.

  • public static bool TryLoad(out Sdl? api)

    Loads SDL, reporting failure rather than throwing.

Used by (4)

  • DesktopGlContextTestsVixen.Platform.Desktop.Tests
  • DesktopPlatformVixen.Platform.Desktop
  • DesktopPlatformTestsVixen.Platform.Desktop.Tests
  • DesktopSupplementTestsVixen.Platform.Desktop.Tests