Skip to content

Instantly share code, notes, and snippets.

@rfht
Created December 25, 2018 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfht/4c0574385f9e3405e9fa055a91ac04ce to your computer and use it in GitHub Desktop.
Save rfht/4c0574385f9e3405e9fa055a91ac04ce to your computer and use it in GitHub Desktop.
Diff to get MonoGame Framework to run on OpenBSD (with xbuild), currently messes up Linux
diff --git a/MonoGame.Framework/Audio/OpenAL.cs b/MonoGame.Framework/Audio/OpenAL.cs
index 9a8eb4202..4d1c6ef69 100644
--- a/MonoGame.Framework/Audio/OpenAL.cs
+++ b/MonoGame.Framework/Audio/OpenAL.cs
@@ -217,9 +217,9 @@ namespace MonoGame.OpenAL
if (CurrentPlatform.OS == OS.Windows)
ret = FuncLoader.LoadLibrary("soft_oal.dll");
else if (CurrentPlatform.OS == OS.Linux)
- ret = FuncLoader.LoadLibrary("libopenal.so.1");
+ ret = FuncLoader.LoadLibrary("libopenal.so");
else
- ret = FuncLoader.LoadLibrary("libopenal.1.dylib");
+ ret = FuncLoader.LoadLibrary("libopenal.so");
}
#elif ANDROID
ret = FuncLoader.LoadLibrary("libopenal32.so");
diff --git a/MonoGame.Framework/SDL/SDL2.cs b/MonoGame.Framework/SDL/SDL2.cs
index 743b4c05e..94cd56177 100644
--- a/MonoGame.Framework/SDL/SDL2.cs
+++ b/MonoGame.Framework/SDL/SDL2.cs
@@ -38,14 +38,14 @@ internal static class Sdl
else if (CurrentPlatform.OS == OS.Linux)
ret = FuncLoader.LoadLibrary("libSDL2-2.0.so.0");
else
- ret = FuncLoader.LoadLibrary("libSDL2-2.0.0.dylib");
+ ret = FuncLoader.LoadLibrary("libSDL2.so");
}
// Welp, all failed, PANIC!!!
- if (ret == IntPtr.Zero)
- throw new Exception("Failed to load SDL library.");
+ //if (ret == IntPtr.Zero)
+ //throw new Exception("Failed to load SDL library.");
- return ret;
+ return FuncLoader.LoadLibrary("/usr/local/lib/libSDL2.so.0.6");
}
public static int Major;
diff --git a/MonoGame.Framework/Utilities/FuncLoader.Android.cs b/MonoGame.Framework/Utilities/FuncLoader.Android.cs
index 35413272b..ba2e7b5f7 100644
--- a/MonoGame.Framework/Utilities/FuncLoader.Android.cs
+++ b/MonoGame.Framework/Utilities/FuncLoader.Android.cs
@@ -5,10 +5,10 @@ namespace MonoGame.Utilities
{
internal class FuncLoader
{
- [DllImport("dl")]
+ [DllImport("libs.so")]
public static extern IntPtr dlopen(string path, int flags);
- [DllImport("dl")]
+ [DllImport("libc.so")]
public static extern IntPtr dlsym(IntPtr handle, string symbol);
private const int RTLD_LAZY = 0x0001;
diff --git a/MonoGame.Framework/Utilities/FuncLoader.Desktop.cs b/MonoGame.Framework/Utilities/FuncLoader.Desktop.cs
index f3553c1f0..ef3448327 100644
--- a/MonoGame.Framework/Utilities/FuncLoader.Desktop.cs
+++ b/MonoGame.Framework/Utilities/FuncLoader.Desktop.cs
@@ -16,10 +16,10 @@ namespace MonoGame.Utilities
private class Linux
{
- [DllImport("libdl.so.2")]
+ [DllImport("__Internal")]
public static extern IntPtr dlopen(string path, int flags);
- [DllImport("libdl.so.2")]
+ [DllImport("__Internal")]
public static extern IntPtr dlsym(IntPtr handle, string symbol);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment