Commit 5a55a34a authored by Sam Hocevar's avatar Sam Hocevar

* ./Makefile: fixed the Win32 interface under Win2k/XP.

  * ./src/misc/modules_plugins.h: implemented a dlerror()-like wrapper
    for the Win32 API.
parent 1ca91e71
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
HEAD HEAD
* ./Makefile: fixed the Win32 interface under Win2k/XP.
* ./src/misc/modules_plugins.h: implemented a dlerror()-like wrapper
for the Win32 API.
* ./configure.in: fixed a bug in the libdvdread detection. * ./configure.in: fixed a bug in the libdvdread detection.
* ./configure.in: fixed plugin compilation under Win32. * ./configure.in: fixed plugin compilation under Win32.
* ./vlc.spec: imported MandrakeSoft's enhancements. * ./vlc.spec: imported MandrakeSoft's enhancements.
......
...@@ -403,7 +403,9 @@ package-win32: ...@@ -403,7 +403,9 @@ package-win32:
cp $(PLUGINS:%=plugins/%.so) tmp/plugins/ cp $(PLUGINS:%=plugins/%.so) tmp/plugins/
# don't include these two # don't include these two
#rm -f tmp/plugins/gtk.so tmp/plugins/sdl.so #rm -f tmp/plugins/gtk.so tmp/plugins/sdl.so
$(STRIP) $(PLUGINS:%=tmp/plugins/%.so) ifneq (,$(PLUGINS))
for i in $(PLUGINS) ; do if test $$i != intfwin ; then $(STRIP) tmp/plugins/$$i.so ; fi ; done
endif
mkdir tmp/share mkdir tmp/share
for file in default8x16.psf default8x9.psf ; \ for file in default8x16.psf default8x9.psf ; \
do cp share/$$file tmp/share/ ; done do cp share/$$file tmp/share/ ; done
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules.c : Built-in and plugin modules management functions * modules.c : Built-in and plugin modules management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.57 2002/04/01 21:54:26 gbazin Exp $ * $Id: modules.c,v 1.58 2002/04/11 08:55:49 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com> * Ethan C. Baldridge <BaldridgeE@cadmus.com>
...@@ -651,9 +651,11 @@ static int AllocatePluginModule( char * psz_filename ) ...@@ -651,9 +651,11 @@ static int AllocatePluginModule( char * psz_filename )
/* Try to dynamically load the module. */ /* Try to dynamically load the module. */
if( module_load( psz_filename, &handle ) ) if( module_load( psz_filename, &handle ) )
{ {
char psz_buffer[256];
/* The plugin module couldn't be opened */ /* The plugin module couldn't be opened */
intf_WarnMsg( 1, "module warning: cannot open %s (%s)", intf_WarnMsg( 1, "module warning: cannot open %s (%s)",
psz_filename, module_error() ); psz_filename, module_error( psz_buffer ) );
return( -1 ); return( -1 );
} }
...@@ -970,9 +972,12 @@ static int LockModule( module_t * p_module ) ...@@ -970,9 +972,12 @@ static int LockModule( module_t * p_module )
if( module_load( p_module->is.plugin.psz_filename, if( module_load( p_module->is.plugin.psz_filename,
&p_module->is.plugin.handle ) ) &p_module->is.plugin.handle ) )
{ {
char psz_buffer[256];
/* The plugin module couldn't be opened */ /* The plugin module couldn't be opened */
intf_ErrMsg( "module error: cannot open %s (%s)", 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 ); return( -1 );
} }
...@@ -1085,11 +1090,13 @@ static int CallSymbol( module_t * p_module, char * psz_name ) ...@@ -1085,11 +1090,13 @@ static int CallSymbol( module_t * p_module, char * psz_name )
if( pf_symbol == NULL ) if( pf_symbol == NULL )
{ {
char psz_buffer[256];
/* We couldn't load the symbol */ /* We couldn't load the symbol */
intf_WarnMsg( 1, "module warning: " intf_WarnMsg( 1, "module warning: "
"cannot find symbol %s in module %s (%s)", "cannot find symbol %s in module %s (%s)",
psz_name, p_module->is.plugin.psz_filename, psz_name, p_module->is.plugin.psz_filename,
module_error() ); module_error( psz_buffer ) );
return( -1 ); return( -1 );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules_plugin.h : Plugin management functions used by the core application. * modules_plugin.h : Plugin management functions used by the core application.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules_plugin.h,v 1.18 2002/04/02 23:43:57 gbazin Exp $ * $Id: modules_plugin.h,v 1.19 2002/04/11 08:55:49 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -142,15 +142,36 @@ module_getsymbol( module_handle_t handle, char * psz_function ) ...@@ -142,15 +142,36 @@ module_getsymbol( module_handle_t handle, char * psz_function )
* module_error: wrapper for dlerror() * module_error: wrapper for dlerror()
***************************************************************************** *****************************************************************************
* This function returns the error message of the last module operation. It * This function returns the error message of the last module operation. It
* returns the string "failed" on systems which do not have the dlerror() * returns the string "failed" on systems which do not have a dlerror() like
* function. * function. psz_buffer can be used to store temporary data, it is guaranteed
* to be kept intact until the return value of module_error has been used.
*****************************************************************************/ *****************************************************************************/
static __inline__ const char * static __inline__ const char *
module_error( void ) module_error( char *psz_buffer )
{ {
#if defined(SYS_BEOS) || defined(WIN32) #if defined(SYS_BEOS)
return( "failed" ); return( "failed" );
#elif defined(WIN32)
int i, i_error = GetLastError();
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, i_error, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) psz_buffer, 256, NULL);
/* Go to the end of the string */
for( i = 0;
psz_buffer[i] && psz_buffer[i] != '\r' && psz_buffer[i] != '\n';
i++ ) {};
if( psz_buffer[i] )
{
snprintf( psz_buffer + i, 256 - i, " (error %i)", i_error );
psz_buffer[ 255 ] = '\0';
}
return psz_buffer;
#else #else
return( dlerror() ); return( dlerror() );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment