1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-19 05:37:26 +00:00

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).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29224 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-04-23 10:18:32 +00:00
parent e3f02a93cc
commit d6cf125d94

View File

@ -1536,22 +1536,17 @@ void swapGlBuffers(void) {
* \brief find address of a linked function * \brief find address of a linked function
* \param s name of function to find * \param s name of function to find
* \return address of function or NULL if not found * \return address of function or NULL if not found
*
* Copied from xine
*/ */
static void *getdladdr(const char *s) { static void *getdladdr(const char *s) {
void *ret = NULL;
#ifdef HAVE_LIBDL #ifdef HAVE_LIBDL
#if defined(__sun) || defined(__sgi) void *handle = dlopen(NULL, RTLD_LAZY);
static void *handle = NULL;
if (!handle) if (!handle)
handle = dlopen(NULL, RTLD_LAZY); return NULL;
return dlsym(handle, s); ret = dlsym(handle, s);
#else dlclose(handle);
return dlsym(0, s);
#endif
#else
return NULL;
#endif #endif
return ret;
} }
/** /**