Temporarily fix Stbi.

This commit is contained in:
H. Utku Maden 2023-07-09 17:05:01 +03:00
parent afd73d1622
commit 3e7de074c6

@ -12,9 +12,14 @@ namespace Quik.Stb
private static readonly string[] LibraryNames = new string[]
{
"runtimes/libstbi.dll",
"runtimes/libstbi.so",
"runtimes/libstbi.dylib",
//FIXME: This is wrong on so many levels, but, i need to do this
// in order to get a change of this running.
"runtimes/win-x64/native/libstbi.dll",
"runtimes/win-x86/native/libstbi.dll",
"runtimes/linux-arm/native/libstbi.so",
"runtimes/linux-arm64/native/libstbi.so",
"runtimes/linux-x64/native/libstbi.so",
"runtimes/native/libstbi.dylib",
"libstbi.dll",
"libstbi.so",
"libstbi.dylib",
@ -27,21 +32,14 @@ namespace Quik.Stb
quik_stbi_failed_assert_store(Marshal.GetFunctionPointerForDelegate<FailedAssertProc>(FailedAssert));
}
private const DllImportSearchPath SearchPath =
DllImportSearchPath.ApplicationDirectory |
DllImportSearchPath.UserDirectories |
DllImportSearchPath.AssemblyDirectory |
DllImportSearchPath.UseDllDirectoryForDependencies;
private static IntPtr Resolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
{
Debugger.Break();
if (libraryName != "stbi")
return IntPtr.Zero;
foreach (string name in LibraryNames)
{
if (NativeLibrary.TryLoad(name, assembly, SearchPath, out IntPtr handle))
if (NativeLibrary.TryLoad(name, assembly, searchPath, out IntPtr handle))
{
return handle;
}