Commit cd5ed364 authored by Damien Fouilleul's avatar Damien Fouilleul

- added controlled symbol export support for win32. Now, all visible symbols...

- added controlled symbol export support for win32. Now, all visible symbols in libvlc.dll must be declared using either VLC_EXPORT or VLC_PUBLIC_API. Otherwise, they will not be exported. this has the advantage of reducing the number of symbols in the DLL, saving on file size an binding time at runtime. All exported symbols will be listed in the libvlc.def file.
This also pave the way for using the visibility feature in GCC 4, adding controlled symbols export for UNIX/MacOS X as well.
parent d20a2464
...@@ -5602,6 +5602,7 @@ AS_IF([test "${SYS}" = "mingw32" || test "${enable_libtool}" != "no"], [ ...@@ -5602,6 +5602,7 @@ AS_IF([test "${SYS}" = "mingw32" || test "${enable_libtool}" != "no"], [
AC_DEFINE(HAVE_SHARED_LIBVLC, 1, [Define to 1 if libvlc is built as a shared library.]) AC_DEFINE(HAVE_SHARED_LIBVLC, 1, [Define to 1 if libvlc is built as a shared library.])
FILE_LIBVLC_DLL="!define LIBVLC_DLL libvlc.dll" FILE_LIBVLC_DLL="!define LIBVLC_DLL libvlc.dll"
VLC_ADD_PLUGINS([${BUILTINS}]) VLC_ADD_PLUGINS([${BUILTINS}])
VLC_ADD_CPPFLAGS([libvlc],[-DDLL_EXPORT])
BUILTINS="" BUILTINS=""
], [ ], [
LDFLAGS_vlc="${LDFLAGS_vlc} ${LDFLAGS_libvlc}" LDFLAGS_vlc="${LDFLAGS_vlc} ${LDFLAGS_libvlc}"
......
This diff is collapsed.
This diff is collapsed.
...@@ -472,17 +472,27 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */ ...@@ -472,17 +472,27 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */
#include "vlc_modules_macros.h" #include "vlc_modules_macros.h"
#if !defined (__PLUGIN__) || defined (HAVE_SHARED_LIBVLC) #if defined (WIN32) && defined (DLL_EXPORT)
# ifdef __cplusplus
# define VLC_EXPORT( type, name, args ) extern "C" __declspec(dllexport) type name args
# define VLC_INTERNAL( type, name, args ) extern "C" type name args
# else
# define VLC_EXPORT( type, name, args ) __declspec(dllexport) type name args
# define VLC_INTERNAL( type, name, args ) type name args
# endif
#else
# if !defined (__PLUGIN__) || defined (HAVE_SHARED_LIBVLC)
# ifdef __cplusplus # ifdef __cplusplus
# define VLC_EXPORT( type, name, args ) extern "C" type name args # define VLC_EXPORT( type, name, args ) extern "C" type name args
# else # else
# define VLC_EXPORT( type, name, args ) type name args # define VLC_EXPORT( type, name, args ) type name args
# endif # endif
#else # else
# define VLC_EXPORT( type, name, args ) struct _u_n_u_s_e_d_ # define VLC_EXPORT( type, name, args ) struct _u_n_u_s_e_d_
extern module_symbols_t* p_symbols; extern module_symbols_t* p_symbols;
# endif
# define VLC_INTERNAL( type, name, args ) VLC_EXPORT (type, name, args)
#endif #endif
#define VLC_INTERNAL( type, name, args ) VLC_EXPORT (type, name, args)
/***************************************************************************** /*****************************************************************************
* OS-specific headers and thread types * OS-specific headers and thread types
...@@ -987,7 +997,7 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw ) ...@@ -987,7 +997,7 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
# include <dirent.h> # include <dirent.h>
VLC_INTERNAL( void *, vlc_wopendir, ( const wchar_t * ) ); VLC_INTERNAL( void *, vlc_wopendir, ( const wchar_t * ) );
VLC_INTERNAL( struct _wdirent *, vlc_wreaddir, ( void * ) ); VLC_INTERNAL( struct _wdirent *, vlc_wreaddir, ( void * ) );
VLC_INTERNAL( int, vlc_wclosedir, ( void * ) ); VLC_EXPORT( int, vlc_wclosedir, ( void * ) );
VLC_INTERNAL( void, vlc_rewinddir, ( void * ) ); VLC_INTERNAL( void, vlc_rewinddir, ( void * ) );
VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) ); VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) );
VLC_INTERNAL( long, vlc_telldir, ( void * ) ); VLC_INTERNAL( long, vlc_telldir, ( void * ) );
......
###############################################################################
# Automake targets and declarations # Automake targets and declarations
############################################################################### ###############################################################################
...@@ -156,8 +156,8 @@ endif ...@@ -156,8 +156,8 @@ endif
if HAVE_WIN32 if HAVE_WIN32
DATA_noinst_libvlc = libvlc$(LIBEXT) libvlc$(LIBEXT).a DATA_noinst_libvlc = libvlc$(LIBEXT) libvlc$(LIBEXT).a
libvlc.dll.a: libvlc$(LIBEXT) libvlc.dll.a libvlc.def: libvlc$(LIBEXT)
$(DLLTOOL) --export-all-symbols -l $@ -D $< $(libvlc_a_OBJECTS) $(DLLTOOL) -z libvlc.def -l libvlc.dll.a -D $< $(libvlc_a_OBJECTS)
libvlc$(LIBEXT): $(libvlc_a_OBJECTS) libvlc$(LIBEXT): $(libvlc_a_OBJECTS)
@ldfl="`$(VLC_CONFIG) --libs plugin libvlc pic` $(INCLUDED_LIBINTL)" ; \ @ldfl="`$(VLC_CONFIG) --libs plugin libvlc pic` $(INCLUDED_LIBINTL)" ; \
......
...@@ -75,8 +75,10 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -75,8 +75,10 @@ int main( int i_argc, char *ppsz_argv[] )
} }
#endif #endif
rootwrap (); #if defined (HAVE_GETEUID) && !defined (SYS_BEOS)
rootwrap ();
#endif
/* Create a libvlc structure */ /* Create a libvlc structure */
i_ret = VLC_Create(); i_ret = VLC_Create();
if( i_ret < 0 ) if( i_ret < 0 )
......
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