* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.56 2002/03/01 16:07:00 sam Exp $
+ * $Id: modules.c,v 1.62 2002/05/22 19:31:33 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
#include <videolan/vlc.h>
-#if !defined( _MSC_VER )
#include <dirent.h>
-#endif
#if defined(HAVE_DLFCN_H) /* Linux, BSD, Hurd */
# include <dlfcn.h> /* dlopen(), dlsym(), dlclose() */
#elif defined(HAVE_IMAGE_H) /* BeOS */
# include <image.h>
# define HAVE_DYNAMIC_PLUGINS
-#elif defined(WIN32) && defined( __MINGW32__ )
+#elif defined(WIN32)
# define HAVE_DYNAMIC_PLUGINS
#else
# undef HAVE_DYNAMIC_PLUGINS
#ifdef HAVE_DYNAMIC_PLUGINS
# include "modules_plugin.h"
#endif
-#include "modules_builtin.h"
+
+#if !defined( _MSC_VER )
+# include "modules_builtin.h"
+#else
+# include "modules_builtin_msvc.h"
+#endif
/*****************************************************************************
* Local prototypes
continue;
}
- /* Test if this plugin exports the required shortcut */
+ /* If we required a shortcut, check this plugin provides it. */
if( psz_name != NULL && *psz_name )
{
- boolean_t b_ok = 0;
+ boolean_t b_trash = 1;
int i_dummy;
for( i_dummy = 0;
- !b_ok && p_module->pp_shortcuts[i_dummy];
+ b_trash && p_module->pp_shortcuts[i_dummy];
i_dummy++ )
{
- b_ok = !strcmp( psz_name, p_module->pp_shortcuts[i_dummy] );
+ b_trash = strcmp( psz_name, p_module->pp_shortcuts[i_dummy] );
}
- if( !b_ok )
+ if( b_trash )
{
continue;
}
}
+ /* If we didn't require a shortcut, trash zero-scored plugins */
+ else if( !p_module->pi_score[i_capability] )
+ {
+ continue;
+ }
/* Special case: test if we requested a particular intf plugin */
if( i_capability == MODULE_CAPABILITY_INTF )
/* Try to dynamically load the module. */
if( module_load( psz_filename, &handle ) )
{
+ char psz_buffer[256];
+
/* The plugin module couldn't be opened */
intf_WarnMsg( 1, "module warning: cannot open %s (%s)",
- psz_filename, module_error() );
+ psz_filename, module_error( psz_buffer ) );
return( -1 );
}
if( module_load( p_module->is.plugin.psz_filename,
&p_module->is.plugin.handle ) )
{
+ char psz_buffer[256];
+
/* The plugin module couldn't be opened */
intf_ErrMsg( "module error: cannot open %s (%s)",
- p_module->is.plugin.psz_filename, module_error() );
+ p_module->is.plugin.psz_filename,
+ module_error( psz_buffer ) );
return( -1 );
}
if( pf_symbol == NULL )
{
+ char psz_buffer[256];
+
/* We couldn't load the symbol */
intf_WarnMsg( 1, "module warning: "
"cannot find symbol %s in module %s (%s)",
psz_name, p_module->is.plugin.psz_filename,
- module_error() );
+ module_error( psz_buffer ) );
return( -1 );
}