Class NativeLibraryLoader

java.lang.Object
dev.engine.core.native_.NativeLibraryLoader

public class NativeLibraryLoader extends Object
General-purpose native library loader.

Resolves native libraries/tools for the current platform by:

  1. Checking the cache directory (~/.engine/natives/ by default)
  2. Extracting from classpath resources if bundled in the JAR
  3. Downloading from a URL if configured in the spec

Results are cached per name/version/platform — subsequent calls are instant.

This loader is not Slang-specific. Any native dependency can use it: wgpu-native, SDL3, physics libraries, etc.

  • Constructor Details

    • NativeLibraryLoader

      public NativeLibraryLoader(Path cacheDir)
  • Method Details

    • defaultLoader

      public static NativeLibraryLoader defaultLoader()
      Creates a loader with the default cache at ~/.engine/natives/ (override via ENGINE_NATIVE_CACHE env var)
    • resolve

      public NativeLibraryResult resolve(NativeLibrarySpec spec)
      Resolves a native library for the current platform. Checks cache → classpath → download, in that order.