[vlc-devel] commit: Move libvlccore into the global symbol namespace if needed ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Dec 21 11:22:36 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Dec 21 12:21:08 2008 +0200| [74b65ec94337aa00944f3527877c63ac675ff7e7] | committer: Rémi Denis-Courmont
Move libvlccore into the global symbol namespace if needed
Should fix #2257
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74b65ec94337aa00944f3527877c63ac675ff7e7
---
src/modules/os.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/modules/os.c b/src/modules/os.c
index 91a5c12..38df5e7 100644
--- a/src/modules/os.c
+++ b/src/modules/os.c
@@ -128,6 +128,16 @@ int module_Call( vlc_object_t *obj, module_t *p_module )
return 0;
}
+#if defined (RTLD_NOLOAD)
+/* Make sure libvlccore is in the global namespace */
+static void load_libvlccore( void )
+{
+ if( !dlsym( RTLD_DEFAULT, "vlc_module_create" )
+ && !dlopen( "libvlccore.so", RTLD_GLOBAL|RTLD_NOLOAD ) )
+ fprintf( stderr, "ERROR: failed loading libvlccore\n" );
+}
+#endif
+
/**
* Load a dynamically linked library using a system dependent method.
*
@@ -204,6 +214,11 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
}
#elif defined(HAVE_DL_DLOPEN) && defined(RTLD_NOW)
+# if defined (RTLD_NOLOAD)
+ static pthread_once_t once = PTHREAD_ONCE_INIT;
+ pthread_once( &once, &load_libvlccore );
+# endif
+
/* static is OK, we are called atomically */
handle = dlopen( psz_file, RTLD_NOW );
if( handle == NULL )
More information about the vlc-devel
mailing list