changeset 29183:edd77b4f699b

Change getdladdr to always use dlopen, dlsym and then dlclose. Performance is not really important and dlsym(0, ...) is not defined while the more correct dlsym(RTLD_DEFAULT, ...) is a GNUism (although POSIX does reserve RTLD_DEFAULT).
author reimar
date Thu, 23 Apr 2009 10:18:32 +0000
parents ecb3c5f2fdd1
children 5f1e8f1b3c30
files libvo/gl_common.c
diffstat 1 files changed, 6 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Thu Apr 23 08:46:05 2009 +0000
+++ b/libvo/gl_common.c	Thu Apr 23 10:18:32 2009 +0000
@@ -1536,22 +1536,17 @@
  * \brief find address of a linked function
  * \param s name of function to find
  * \return address of function or NULL if not found
- *
- * Copied from xine
  */
 static void *getdladdr(const char *s) {
+  void *ret = NULL;
 #ifdef HAVE_LIBDL
-#if defined(__sun) || defined(__sgi)
-  static void *handle = NULL;
+  void *handle = dlopen(NULL, RTLD_LAZY);
   if (!handle)
-    handle = dlopen(NULL, RTLD_LAZY);
-  return dlsym(handle, s);
-#else
-  return dlsym(0, s);
+    return NULL;
+  ret = dlsym(handle, s);
+  dlclose(handle);
 #endif
-#else
-  return NULL;
-#endif
+  return ret;
 }
 
 /**