blob: 76d61e93d4b417da72d75f2600df9507f40b3a4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
$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);
|