From: Sam Hocevar Date: Mon, 10 Feb 2003 20:11:14 +0000 (+0000) Subject: * ./src/misc/modules_plugin.h.in: when opening the KDE plugin, we first X-Git-Tag: 0.5.1~69 X-Git-Url: https://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;p=vlc.git;a=commitdiff_plain;h=360d2a9bf32687f768d79e7dcea0761b255da5a7;ds=sidebyside * ./src/misc/modules_plugin.h.in: when opening the KDE plugin, we first dlopen(libstdc++) to avoid dlopen(kde_plugin) from crashing. Call me evil. --- diff --git a/src/misc/modules_plugin.h.in b/src/misc/modules_plugin.h.in index 192b53ddd0..07c4696493 100644 --- a/src/misc/modules_plugin.h.in +++ b/src/misc/modules_plugin.h.in @@ -2,7 +2,7 @@ * modules_plugin.h : Plugin management functions used by the core application. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules_plugin.h.in,v 1.8 2002/12/06 10:10:39 sam Exp $ + * $Id: modules_plugin.h.in,v 1.9 2003/02/10 20:11:14 sam Exp $ * * Authors: Samuel Hocevar * @@ -42,16 +42,31 @@ static int module_load( const MYCHAR * psz_filename, module_handle_t * handle ) return( *handle == NULL ); #elif defined(RTLD_NOW) + /* static is OK, we are called atomically */ + static vlc_bool_t b_kde = VLC_FALSE; + # if defined(SYS_LINUX) - /* We should NOT open modules with RTLD_GLOBAL, or we are going to get - * namespace collisions when two modules have common public symbols, - * but ALSA is being a pest here. */ - if( strstr( psz_filename, "alsa" ) ) + /* XXX HACK #1 - we should NOT open modules with RTLD_GLOBAL, or we + * are going to get namespace collisions when two modules have common + * public symbols, but ALSA is being a pest here. */ + if( strstr( psz_filename, "alsa_plugin" ) ) { *handle = dlopen( psz_filename, RTLD_NOW | RTLD_GLOBAL ); return( *handle == NULL ); } # endif + /* XXX HACK #2 - the ugly KDE workaround. It seems that libkdewhatever + * causes dlopen() to segfault if libstdc++ is not loaded in the caller, + * so we just load libstdc++. Bwahahaha! ph34r! -- Sam. */ + if( !b_kde && !strstr( psz_filename, "kde" ) ) + { + dlopen( "libstdc++.so.6", RTLD_NOW ) + || dlopen( "libstdc++.so.5", RTLD_NOW ) + || dlopen( "libstdc++.so.4", RTLD_NOW ) + || dlopen( "libstdc++.so.3", RTLD_NOW ); + b_kde = VLC_TRUE; + } + *handle = dlopen( psz_filename, RTLD_NOW ); return( *handle == NULL );