[vlc-devel] [patch] Alter symbol-globalising dlopen(RTLD_NOLOAD) call to succeed

Rémi Denis-Courmont rdenis at simphalempin.com
Thu Feb 12 10:31:58 CET 2009


This patch is wrong. We don't want to load libvlccore unconditionnally.
Otherwise, we would link plugins against it in the first place, and get rid
of this hack altogether.

On Wed, 11 Feb 2009 22:07:06 +0100 (CET), jpd at m2x.nl wrote:
> Always run dlopen(vlccore,RTLD_NOLOAD) when available and add RTLD_NOW to
> prevent the call from failing with an invalid argument error.
> 
> diff --git a/src/modules/os.c b/src/modules/os.c
> index 53368e4..79f227d 100644
> --- a/src/modules/os.c
> +++ b/src/modules/os.c
> @@ -136,9 +136,11 @@ int module_Call( vlc_object_t *obj, module_t
> *p_module )
>  /* Make sure libvlccore is in the global namespace */
>  static void load_libvlccore( void )
>  {
> -    if( !dlsym( RTLD_DEFAULT, "libvlc_Quit" )
> -     && !dlopen( "libvlccore.so", RTLD_GLOBAL|RTLD_NOLOAD ) )
> -        fprintf( stderr, "ERROR: failed loading libvlccore\n" );
> +    // Need either RTLD_NOW or RTLD_LAZY or the call will fail even with
> +    // RTLD_NOLOAD set.
> +    if( !dlopen( "libvlccore.so", RTLD_GLOBAL|RTLD_NOLOAD|RTLD_NOW ) )
> +        fprintf( stderr, "ERROR: failed loading libvlccore (%s)\n",
> +                 dlerror() );
>  }
>  #endif

-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list