From 1d066ee387153e114db49bab179a885551a26920 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 31 May 2001 12:45:39 +0000 Subject: [PATCH] * Win32 plugin support by Gildas Bazin . --- Makefile.opts.in | 3 +++ include/modules_core.h | 21 ++++++++++++++++++--- plugins/gtk/intf_gtk.c | 3 +-- src/input/input.c | 4 ++-- src/misc/modules.c | 4 +++- src/misc/mtime.c | 6 +++--- 6 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Makefile.opts.in b/Makefile.opts.in index 11771982d0..cbd594dfb1 100644 --- a/Makefile.opts.in +++ b/Makefile.opts.in @@ -212,6 +212,9 @@ DCFLAGS += -MM LCFLAGS += @LCFLAGS@ $(LIB) LCFLAGS += -Wall #LCFLAGS += -s +ifneq (,$(findstring mingw32,$(SYS))) +LCFLAGS += -Xlinker --force-exe-suffix +endif # # Debugging and profiling support diff --git a/include/modules_core.h b/include/modules_core.h index ed15f3a460..c56bc0fc28 100644 --- a/include/modules_core.h +++ b/include/modules_core.h @@ -2,7 +2,7 @@ * modules_core.h : Module management functions used by the core application. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules_core.h,v 1.5 2001/03/21 13:42:33 sam Exp $ + * $Id: modules_core.h,v 1.6 2001/05/31 12:45:39 sam Exp $ * * Authors: Samuel Hocevar * @@ -37,12 +37,17 @@ module_load( char * psz_filename, module_handle_t * handle ) #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 */ *handle = dlopen( psz_filename, RTLD_NOW ); - return( *handle == NULL ); + #endif } @@ -58,8 +63,13 @@ module_unload( module_handle_t handle ) { #ifdef SYS_BEOS unload_add_on( handle ); + +#elif defined(WIN32) + FreeLibrary( handle ); + #else dlclose( handle ); + #endif return; } @@ -101,6 +111,9 @@ module_getsymbol( module_handle_t handle, char * psz_function ) free( psz_call ); return( p_return ); +#elif defined(WIN32) + return( (void *)GetProcAddress( handle, psz_function ) ); + #else return( dlsym( handle, psz_function ) ); #endif @@ -116,10 +129,12 @@ module_getsymbol( module_handle_t handle, char * psz_function ) static __inline__ const char * module_error( void ) { -#ifdef SYS_BEOS +#if defined(SYS_BEOS) || defined(WIN32) return( "failed" ); + #else return( dlerror() ); + #endif } diff --git a/plugins/gtk/intf_gtk.c b/plugins/gtk/intf_gtk.c index 447d096882..79aeade9a6 100644 --- a/plugins/gtk/intf_gtk.c +++ b/plugins/gtk/intf_gtk.c @@ -2,7 +2,7 @@ * intf_gtk.c: Gtk+ interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gtk.c,v 1.24 2001/05/31 03:23:24 sam Exp $ + * $Id: intf_gtk.c,v 1.25 2001/05/31 12:45:39 sam Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -35,7 +35,6 @@ #include /* strerror() */ #include -#include #include #include "config.h" diff --git a/src/input/input.c b/src/input/input.c index 950f11556b..a06c5510d0 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -4,7 +4,7 @@ * decoders. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input.c,v 1.117 2001/05/31 03:57:54 sam Exp $ + * $Id: input.c,v 1.118 2001/05/31 12:45:39 sam Exp $ * * Authors: Christophe Massiot * @@ -519,7 +519,7 @@ static void FileOpen( input_thread_t * p_input ) 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 ) diff --git a/src/misc/modules.c b/src/misc/modules.c index d31f7dde76..fc1560abb6 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -2,7 +2,7 @@ * modules.c : Built-in and plugin modules management functions ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules.c,v 1.32 2001/05/31 01:37:08 sam Exp $ + * $Id: modules.c,v 1.33 2001/05/31 12:45:39 sam Exp $ * * Authors: Samuel Hocevar * Ethan C. Baldridge @@ -45,6 +45,8 @@ #elif defined(HAVE_IMAGE_H) /* BeOS */ # include # define HAVE_DYNAMIC_PLUGINS +#elif defined(WIN32) +# define HAVE_DYNAMIC_PLUGINS #else # undef HAVE_DYNAMIC_PLUGINS #endif diff --git a/src/misc/mtime.c b/src/misc/mtime.c index a391c6e412..2afe4289fd 100644 --- a/src/misc/mtime.c +++ b/src/misc/mtime.c @@ -3,7 +3,7 @@ * Functions are prototyped in mtime.h. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: mtime.c,v 1.20 2001/05/31 03:12:49 sam Exp $ + * $Id: mtime.c,v 1.21 2001/05/31 12:45:39 sam Exp $ * * Authors: Vincent Seguin * @@ -68,13 +68,13 @@ static __inline__ void usleep( unsigned int i_useconds ) { 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 -- 2.11.4.GIT