40 lines
1 KiB
Text
40 lines
1 KiB
Text
$NetBSD: patch-aa,v 1.15 2012/09/14 13:20:20 wiz Exp $
|
|
|
|
Try to dlopen the libraries straight from the directories they are in.
|
|
|
|
--- src/loadso/dlopen/SDL_sysloadso.c.orig 2006-05-01 01:02:37.000000000 -0700
|
|
+++ src/loadso/dlopen/SDL_sysloadso.c
|
|
@@ -31,9 +31,32 @@
|
|
|
|
#include "SDL_loadso.h"
|
|
|
|
+static void *get_dlopen_handle(const char *sofile)
|
|
+{
|
|
+ static const char * const libdirs[] = {
|
|
+ PREFIX "/lib/",
|
|
+ X11BASE "/lib/",
|
|
+ };
|
|
+ unsigned i;
|
|
+ void *handle;
|
|
+
|
|
+ for (i = 0; i < sizeof libdirs / sizeof libdirs[0]; i++) {
|
|
+ char buf[1024];
|
|
+
|
|
+ strncpy(buf, libdirs[i], sizeof(buf) - 1);
|
|
+ buf[sizeof(buf) - 1] = '\0';
|
|
+ strncat(buf, sofile, sizeof(buf) - strlen(buf) - 1);
|
|
+
|
|
+ handle = dlopen(buf, RTLD_NOW);
|
|
+ if (handle)
|
|
+ break;
|
|
+ }
|
|
+ return handle;
|
|
+}
|
|
+
|
|
void *SDL_LoadObject(const char *sofile)
|
|
{
|
|
- void *handle = dlopen(sofile, RTLD_NOW);
|
|
+ void *handle = get_dlopen_handle(sofile);
|
|
const char *loaderror = (char *)dlerror();
|
|
if ( handle == NULL ) {
|
|
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
|