[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] spd_audio: Expose dlopened library's symbols to libs it loads.
From: |
Christopher Brannon |
Subject: |
[PATCH] spd_audio: Expose dlopened library's symbols to libs it loads. |
Date: |
Wed, 14 Aug 2013 19:26:30 -0700 |
This fixes the following issue.
* Libao is loaded as an audio plugin.
* Libao loads its own plugins, using dlopen.
* Those plugins try to call functions defined in libao itself,
but fail because the symbols aren't globally available.
---
src/modules/spd_audio.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/modules/spd_audio.c b/src/modules/spd_audio.c
index 95b01f2..3b65bf7 100644
--- a/src/modules/spd_audio.c
+++ b/src/modules/spd_audio.c
@@ -53,6 +53,27 @@
static int spd_audio_log_level;
static lt_dlhandle lt_h;
+/* Dynamically load a library with RTLD_GLOBAL set.
+
+ This is needed when a dynamically-loaded library has its own plugins
+ that call into the parent library.
+ Most of the credit for this function goes to Gary Vaughan.
+*/
+static lt_dlhandle my_dlopenextglobal(const char *filename)
+{
+ lt_dlhandle handle = NULL;
+ lt_dladvise advise;
+
+ if (lt_dladvise_init(&advise))
+ return handle;
+
+ if (!lt_dladvise_ext(&advise) && !lt_dladvise_global(&advise))
+ handle = lt_dlopenadvise(filename, advise);
+
+ lt_dladvise_destroy(&advise);
+ return handle;
+}
+
/* Open the audio device.
Arguments:
@@ -91,7 +112,7 @@ AudioID *spd_audio_open(char *name, void **pars, char
**error)
}
libname = g_strdup_printf(SPD_AUDIO_LIB_PREFIX "%s", name);
- lt_h = lt_dlopenext(libname);
+ lt_h = my_dlopenextglobal(libname);
g_free(libname);
if (NULL == lt_h) {
*error =
--
1.8.1.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] spd_audio: Expose dlopened library's symbols to libs it loads.,
Christopher Brannon <=