]> git.sesse.net Git - vlc/commitdiff
* ./Makefile: fixed the Win32 interface under Win2k/XP.
authorSam Hocevar <sam@videolan.org>
Thu, 11 Apr 2002 08:55:49 +0000 (08:55 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 11 Apr 2002 08:55:49 +0000 (08:55 +0000)
  * ./src/misc/modules_plugins.h: implemented a dlerror()-like wrapper
    for the Win32 API.

ChangeLog
Makefile
src/misc/modules.c
src/misc/modules_plugin.h

index 4fa96676e8e5bab983cc18c0ed4cfd27742ab605..b43d37dd176b49f021d9900618261595e34e4e36 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
 
 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 plugin compilation under Win32.
   * ./vlc.spec: imported MandrakeSoft's enhancements.
index 0a6db21fd6f9a2e05a67e6625410b4220a64bdf1..4e91452c4ca0ac41cb328a4c6f8d5c16515d235c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -403,7 +403,9 @@ package-win32:
        cp $(PLUGINS:%=plugins/%.so) tmp/plugins/ 
        # don't include these two
        #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
        for file in default8x16.psf default8x9.psf ; \
                do cp share/$$file tmp/share/ ; done
index d6d2a306a2005253a92de95b2c23e4529408c088..b017449dd73086c34ad04394b2c2994426f09c87 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Built-in and plugin modules management functions
  *****************************************************************************
  * 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>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -651,9 +651,11 @@ static int AllocatePluginModule( char * psz_filename )
     /* 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 );
     }
 
@@ -970,9 +972,12 @@ static int LockModule( module_t * p_module )
     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 );
     }
 
@@ -1085,11 +1090,13 @@ static int CallSymbol( module_t * p_module, char * psz_name )
 
     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 );
     }
 
index 0ec0e9fbac005542aae77571542d36e7149f2fcc..36421aa476ee2a8c3999c992ca427007733e1979 100644 (file)
@@ -2,7 +2,7 @@
  * modules_plugin.h : Plugin management functions used by the core application.
  *****************************************************************************
  * 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>
  *
@@ -142,15 +142,36 @@ module_getsymbol( module_handle_t handle, char * psz_function )
  * module_error: wrapper for dlerror()
  *****************************************************************************
  * This function returns the error message of the last module operation. It
- * returns the string "failed" on systems which do not have the dlerror()
- * function.
+ * returns the string "failed" on systems which do not have a dlerror() like
+ * 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 *
-module_error( void )
+module_error( char *psz_buffer )
 {
-#if defined(SYS_BEOS) || defined(WIN32)
+#if defined(SYS_BEOS)
     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
     return( dlerror() );