Skip to content
Permalink
Browse files

Fixed bug 3478 - Patch Haiku to use dlopen instead of load_add_on

Kai Sterker

SDL2 on Haiku so far uses Haiku-specific APIs for loading dynamic objects as add-ons, instead of using dlopen to load them as libraries. This, for example, leads to SDL_mixer not being able to load its audio backends, when compiled with standard settings.

As discussed at https://www.freelists.org/post/haikuports/SDL2-mixer-ogg-music-not-playing-and-other-stuff,2 , the best way to deal with this would be using dlopen instead of load_add_on. The following patch implements this change by dropping the Haiku-specific bits and using dlopen instead.
  • Loading branch information
slouken committed Nov 1, 2016
1 parent 98d188f commit 9a8642bd6a1437e5c1b92a0d0ae7f1ce68a171ba
Showing with 3 additions and 102 deletions.
  1. +1 −8 configure
  2. +1 −6 configure.in
  3. +0 −1 include/SDL_config.h.cmake
  4. +0 −1 include/SDL_config.h.in
  5. +1 −15 src/dynapi/SDL_dynapi.c
  6. +0 −71 src/loadso/haiku/SDL_sysloadso.c
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckDLOPEN
CheckHaikuVideo
CheckHaikuGL
CheckPTHREAD
SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
have_timers=yes
fi
# Set up files for the shared object loading library
if test x$enable_loadso = xyes; then

$as_echo "#define SDL_LOADSO_HAIKU 1" >>confdefs.h

SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c"
have_loadso=yes
fi
# Set up files for the system power library
if test x$enable_power = xyes; then

@@ -3229,6 +3229,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckDLOPEN
CheckHaikuVideo
CheckHaikuGL
CheckPTHREAD
@@ -3251,12 +3252,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
have_timers=yes
fi
# Set up files for the shared object loading library
if test x$enable_loadso = xyes; then
AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ])
SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c"
have_loadso=yes
fi
# Set up files for the system power library
if test x$enable_power = xyes; then
AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
@@ -252,7 +252,6 @@
#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@

/* Enable various shared object loading systems */
#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@
#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@
#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@
@@ -253,7 +253,6 @@
#undef SDL_HAPTIC_XINPUT

/* Enable various shared object loading systems */
#undef SDL_LOADSO_HAIKU
#undef SDL_LOADSO_DLOPEN
#undef SDL_LOADSO_DUMMY
#undef SDL_LOADSO_LDG
@@ -216,21 +216,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
return retval;
}

#elif defined(__HAIKU__)
#include <os/kernel/image.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
image_id lib = load_add_on(fname);
void *retval = NULL;
if (lib >= 0) {
if (get_image_symbol(lib, sym, B_SYMBOL_TYPE_TEXT, &retval) != B_NO_ERROR) {
unload_add_on(lib);
retval = NULL;
}
}
return retval;
}
#elif defined(unix) || defined(__unix__) || defined(__APPLE__)
#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#include <dlfcn.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{

This file was deleted.

0 comments on commit 9a8642b

Please sign in to comment.