dotnet / Silk.NET

The high-speed OpenGL, OpenCL, OpenAL, OpenXR, GLFW, SDL, Vulkan, Assimp, WebGPU, and DirectX bindings library your mother warned you about.
https://dotnet.github.io/Silk.NET
MIT License
3.89k stars 378 forks source link

Silk.NET.Core.Loader.DefaultPathResolver does not check the directory of its own assembly #2128

Open slxdy opened 2 months ago

slxdy commented 2 months ago

The DefaultPathResolver normally assumes that the library is either located in the domain's base dir or the main module's dir (which should usually be the same anyway), but this becomes a problem when Silk is loaded from a different directory. One solution would be to just set the current directory to Silk's directory... or at least that would've been the case if the resolver checked the current directory.

I believe the DefaultPathResolver should also check the directory of its own assembly. Otherwise, it should at the very least check the current directory. This will allow developers to place Silk in directories separate from the exe.

slxdy commented 2 months ago

For context, I am using Silk in a plugin for another application, and since the plugin has its own directory, Silk cannot find its native libraries