patch for plugins support on win32

Gildas Bazin gbazin at netcourrier.com
Thu May 31 07:51:18 CEST 2001


Hi,

Thanks to Sam's modifications to the plugin architecture we can now support
them on win32 !

The following patch enables plugin support on win32 and fixes a couple of
compilation bugs as well.

PS: I only had time to test this with Wine.

--
Gildas

-- Attached file included as plaintext by Listar --

Index: Makefile.opts.in
===================================================================
RCS file: /var/cvs/videolan/vlc/Makefile.opts.in,v
retrieving revision 1.11
diff -u -r1.11 Makefile.opts.in
--- Makefile.opts.in	2001/05/30 17:03:11	1.11
+++ Makefile.opts.in	2001/05/31 05:46:20
@@ -212,6 +212,9 @@
 LCFLAGS += @LCFLAGS@ $(LIB)
 LCFLAGS += -Wall
 #LCFLAGS += -s
+ifneq (,$(findstring mingw32,$(SYS)))
+LCFLAGS += -Xlinker --force-exe-suffix
+endif
 
 #
 # Debugging and profiling support
Index: include/modules_core.h
===================================================================
RCS file: /var/cvs/videolan/vlc/include/modules_core.h,v
retrieving revision 1.5
diff -u -r1.5 modules_core.h
--- include/modules_core.h	2001/03/21 13:42:33	1.5
+++ include/modules_core.h	2001/05/31 05:46:21
@@ -37,6 +37,11 @@
 #ifdef SYS_BEOS
     *handle = load_add_on( psz_filename );
     return( *handle < 0 );
+
+#elif defined(WIN32)
+    *handle = LoadLibrary( psz_filename );
+    return( *handle == NULL ); 
+
 #else
     /* Do not open modules with RTLD_GLOBAL, or we are going to get namespace
      * collisions when two modules have common public symbols */
@@ -58,6 +63,10 @@
 {
 #ifdef SYS_BEOS
     unload_add_on( handle );
+
+#elif defined(WIN32)
+    FreeLibrary( handle );
+
 #else
     dlclose( handle );
 #endif
@@ -101,6 +110,9 @@
     free( psz_call );
     return( p_return );
 
+#elif defined(WIN32)
+    return( (void *)GetProcAddress( handle, psz_function ) );
+
 #else
     return( dlsym( handle, psz_function ) );
 #endif
@@ -116,7 +128,7 @@
 static __inline__ const char *
 module_error( void )
 {
-#ifdef SYS_BEOS
+#if defined(SYS_BEOS) || defined(WIN32)
     return( "failed" );
 #else
     return( dlerror() );
Index: src/input/input.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/input/input.c,v
retrieving revision 1.117
diff -u -r1.117 input.c
--- src/input/input.c	2001/05/31 03:57:54	1.117
+++ src/input/input.c	2001/05/31 05:46:22
@@ -519,7 +519,7 @@
             psz_name += 4;
             i_stat = stat( psz_name, &stat_info );
 #if defined( WIN32 )
-            snprintf( buf, 7, "\\\\.\\%c:", psz_name[0] );
+            _snprintf( buf, 7, "\\\\.\\%c:", psz_name[0] );
 #endif
         }
         else if( ( i_size > 5 )
Index: src/misc/modules.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/misc/modules.c,v
retrieving revision 1.32
diff -u -r1.32 modules.c
--- src/misc/modules.c	2001/05/31 01:37:08	1.32
+++ src/misc/modules.c	2001/05/31 05:46:22
@@ -45,6 +45,8 @@
 #elif defined(HAVE_IMAGE_H)                                          /* BeOS */
 #   include <image.h>
 #   define HAVE_DYNAMIC_PLUGINS
+#elif defined(WIN32)
+#   define HAVE_DYNAMIC_PLUGINS
 #else
 #   undef HAVE_DYNAMIC_PLUGINS
 #endif
Index: src/misc/mtime.c
===================================================================
RCS file: /var/cvs/videolan/vlc/src/misc/mtime.c,v
retrieving revision 1.20
diff -u -r1.20 mtime.c
--- src/misc/mtime.c	2001/05/31 03:12:49	1.20
+++ src/misc/mtime.c	2001/05/31 05:46:22
@@ -68,13 +68,13 @@
     {
         QueryPerformanceCounter( (LARGE_INTEGER *) &i_cur );
 
-        i_now = ( cur * 1000 * 1000 / i_freq );
+        i_now = ( i_cur * 1000 * 1000 / i_freq );
         i_then = i_now + i_useconds;
 
         while( i_now < i_then )
         {
             QueryPerformanceCounter( (LARGE_INTEGER *) &i_cur );
-            now = cur * 1000 * 1000 / i_freq;
+            i_now = i_cur * 1000 * 1000 / i_freq;
         }
     }
     else





















More information about the vlc-devel mailing list