X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fos.c;h=58fef5189ce2f46899627c9232feaecb9b0223ef;hb=6c3b28982261a5552b740a0f6cdc1a300393ee30;hp=ca0e21415059808fecfc6681fcf10b54feb4eeee;hpb=50866663cd6e8fae6917ac6de10c1c4cd232c37d;p=vlc
diff --git a/src/modules/os.c b/src/modules/os.c
index ca0e214150..58fef5189c 100644
--- a/src/modules/os.c
+++ b/src/modules/os.c
@@ -65,6 +65,9 @@
# include
# endif
#endif
+#ifdef HAVE_VALGRIND_VALGRIND_H
+# include
+#endif
/*****************************************************************************
* Local prototypes
@@ -129,16 +132,6 @@ 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.
*
@@ -215,10 +208,6 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
}
#elif defined(HAVE_DL_DLOPEN)
-# if defined (RTLD_NOLOAD)
- static pthread_once_t once = PTHREAD_ONCE_INIT;
- pthread_once( &once, &load_libvlccore );
-# endif
# if defined (RTLD_NOW)
const int flags = RTLD_NOW;
@@ -228,7 +217,7 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
const int flags = 0;
# endif
- handle = dlopen( psz_file, RTLD_NOW );
+ handle = dlopen( psz_file, flags );
if( handle == NULL )
{
msg_Warn( p_this, "cannot load module `%s' (%s)",
@@ -274,11 +263,11 @@ void module_Unload( module_handle_t handle )
FreeLibrary( handle );
#elif defined(HAVE_DL_DLOPEN)
-# ifdef NDEBUG
- dlclose( handle );
-# else
- (void)handle;
+# ifdef HAVE_VALGRIND_VALGRIND_H
+ if( RUNNING_ON_VALGRIND > 0 )
+ return; /* do not dlclose() so that we get proper stack traces */
# endif
+ dlclose( handle );
#elif defined(HAVE_DL_SHL_LOAD)
shl_unload( handle );
@@ -321,8 +310,8 @@ static void *module_Lookup( module_handle_t handle, const char *psz_function )
}
#elif defined(HAVE_DL_WINDOWS) && defined(UNDER_CE)
- wchar_t wide[sizeof( psz_function ) + 1];
- size_t i;
+ wchar_t wide[strlen( psz_function ) + 1];
+ size_t i = 0;
do
wide[i] = psz_function[i]; /* UTF-16 <- ASCII */
while( psz_function[i++] );