Commit 4f33bf88 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Get rid of the symbols structure and use the OS linker

with --enable-shared-libvlc
parent 9fbd6f2e
...@@ -4433,6 +4433,9 @@ AC_ARG_ENABLE(shared-libvlc, ...@@ -4433,6 +4433,9 @@ AC_ARG_ENABLE(shared-libvlc,
,[shared_libvlc=no]) ,[shared_libvlc=no])
AM_CONDITIONAL(BUILD_SHARED, [test "${shared_libvlc}" != "no"]) AM_CONDITIONAL(BUILD_SHARED, [test "${shared_libvlc}" != "no"])
AS_IF([test "${shared_libvlc}" != "no"], [
AC_DEFINE(HAVE_SHARED_LIBVLC, 1, [Define to 1 if libvlc is built as a shared library.])
])
pic=no pic=no
AS_IF([test "${shared_libvlc}" != "no"], [pic=pic]) AS_IF([test "${shared_libvlc}" != "no"], [pic=pic])
......
...@@ -55,7 +55,9 @@ struct module_bank_t ...@@ -55,7 +55,9 @@ struct module_bank_t
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
int i_usage; int i_usage;
#ifndef HAVE_SHARED_LIBVLC
module_symbols_t symbols; module_symbols_t symbols;
#endif
vlc_bool_t b_main; vlc_bool_t b_main;
vlc_bool_t b_builtins; vlc_bool_t b_builtins;
......
This diff is collapsed.
...@@ -194,7 +194,7 @@ void __module_InitBank( vlc_object_t *p_this ) ...@@ -194,7 +194,7 @@ void __module_InitBank( vlc_object_t *p_this )
/* /*
* Store the symbols to be exported * Store the symbols to be exported
*/ */
#ifdef HAVE_DYNAMIC_PLUGINS #if defined (HAVE_DYNAMIC_PLUGINS) && !defined (HAVE_SHARED_LIBVLC)
STORE_SYMBOLS( &p_bank->symbols ); STORE_SYMBOLS( &p_bank->symbols );
#endif #endif
...@@ -1090,7 +1090,9 @@ static module_t * AllocatePlugin( vlc_object_t * p_this, char * psz_file ) ...@@ -1090,7 +1090,9 @@ static module_t * AllocatePlugin( vlc_object_t * p_this, char * psz_file )
/* We need to fill these since they may be needed by CallEntry() */ /* We need to fill these since they may be needed by CallEntry() */
p_module->psz_filename = psz_file; p_module->psz_filename = psz_file;
p_module->handle = handle; p_module->handle = handle;
#ifndef HAVE_SHARED_LIBVLC
p_module->p_symbols = &p_this->p_libvlc->p_module_bank->symbols; p_module->p_symbols = &p_this->p_libvlc->p_module_bank->symbols;
#endif
p_module->b_loaded = VLC_TRUE; p_module->b_loaded = VLC_TRUE;
/* Initialize the module: fill p_module, default config */ /* Initialize the module: fill p_module, default config */
...@@ -2146,7 +2148,9 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache, ...@@ -2146,7 +2148,9 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache,
p_cache->pf_activate = p_module->pf_activate; p_cache->pf_activate = p_module->pf_activate;
p_cache->pf_deactivate = p_module->pf_deactivate; p_cache->pf_deactivate = p_module->pf_deactivate;
#ifndef HAVE_SHARED_LIBVLC
p_cache->p_symbols = p_module->p_symbols; p_cache->p_symbols = p_module->p_symbols;
#endif
p_cache->handle = p_module->handle; p_cache->handle = p_module->handle;
for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ ) for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ )
...@@ -2155,7 +2159,9 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache, ...@@ -2155,7 +2159,9 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache,
module_t *p_cchild = (module_t*)p_cache->pp_children[i_submodule]; module_t *p_cchild = (module_t*)p_cache->pp_children[i_submodule];
p_cchild->pf_activate = p_child->pf_activate; p_cchild->pf_activate = p_child->pf_activate;
p_cchild->pf_deactivate = p_child->pf_deactivate; p_cchild->pf_deactivate = p_child->pf_deactivate;
#ifndef HAVE_SHARED_LIBVLC
p_cchild->p_symbols = p_child->p_symbols; p_cchild->p_symbols = p_child->p_symbols;
#endif
} }
p_cache->b_loaded = VLC_TRUE; p_cache->b_loaded = VLC_TRUE;
......
...@@ -52,6 +52,30 @@ print { $new_sym } ...@@ -52,6 +52,30 @@ print { $new_sym }
"#ifndef __VLC_SYMBOLS_H\n". "#ifndef __VLC_SYMBOLS_H\n".
"# define __VLC_SYMBOLS_H\n". "# define __VLC_SYMBOLS_H\n".
"\n". "\n".
"# ifdef HAVE_SHARED_LIBVLC\n".
"/*\n".
" * In an ideal world, plugins would include all the headers they need.\n".
" * But of course, many, if not all, of them don't, so we have to make sure\n".
" * the while libvlc API is defined here in any case when included from a\n".
" * plugin.\n".
" */\n".
"# ifdef __PLUGIN__\n".
"# ifdef __cplusplus\n".
"extern \"C\" {\n".
"# endif\n";
foreach (keys %new_APIs)
{
print { $new_sym }
$new_APIs{$_}[0]." $_ (".$new_APIs{$_}[1].");\n";
}
print { $new_sym }
"# ifdef __cplusplus\n".
"}\n".
"# endif\n".
"# endif /* __PLUGIN__ */\n".
"# else /* HAVE_LIBVLC_SHARED */\n".
"/*\n". "/*\n".
" * This is the big VLC API structure for plugins :\n". " * This is the big VLC API structure for plugins :\n".
" * Changing its layout breaks plugin's binary compatibility,\n". " * Changing its layout breaks plugin's binary compatibility,\n".
...@@ -70,15 +94,24 @@ my $changes = 0; ...@@ -70,15 +94,24 @@ my $changes = 0;
# #
my @API; my @API;
my @deprecated_API; my @deprecated_API;
my $parse = 0;
open my $oldfd, "< $srcdir/include/vlc_symbols.h"; open my $oldfd, "< $srcdir/include/vlc_symbols.h";
while (<$oldfd>) while (<$oldfd>)
{ {
if (/^ void \*(\w*)_deprecated;$/) if (/^struct module_symbols_t/)
{
$parse = 1;
}
elsif ($parse == 0)
{ {
if (defined $new_APIs{$2}) }
elsif (/^ void \*(\w*)_deprecated;$/)
{
if (defined $new_APIs{$1})
{ {
print "[info] $2 was RESTORED!\n"; print "[info] $1 was RESTORED!\n";
print { $new_sym } print { $new_sym }
" ".$new_APIs{$1}[0]." (*$1_inner) (".$new_APIs{$1}[1].");\n"; " ".$new_APIs{$1}[0]." (*$1_inner) (".$new_APIs{$1}[1].");\n";
delete $new_APIs{$1}; delete $new_APIs{$1};
...@@ -143,19 +176,19 @@ foreach (keys %new_APIs) ...@@ -143,19 +176,19 @@ foreach (keys %new_APIs)
# #
print { $new_sym } print { $new_sym }
"};\n". "};\n".
"# if defined (__PLUGIN__)\n"; "# if defined (__PLUGIN__)\n";
foreach (@API) foreach (@API)
{ {
print { $new_sym } "# define $_ (p_symbols)->${_}_inner\n"; print { $new_sym } "# define $_ (p_symbols)->${_}_inner\n";
} }
print { $new_sym } print { $new_sym }
"# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)\n". "# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)\n".
"/******************************************************************\n". "/******************************************************************\n".
" * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.\n". " * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.\n".
" ******************************************************************/\n". " ******************************************************************/\n".
"# define STORE_SYMBOLS( p_symbols ) \\\n"; "# define STORE_SYMBOLS( p_symbols ) \\\n";
foreach (@API) foreach (@API)
{ {
...@@ -168,7 +201,8 @@ foreach (@deprecated_API) ...@@ -168,7 +201,8 @@ foreach (@deprecated_API)
print { $new_sym } print { $new_sym }
"\n". "\n".
"# endif /* __PLUGIN__ */\n". "# endif /* __PLUGIN__ */\n".
"# endif /* HAVE_SHARED_LIBVLC */\n".
"#endif /* __VLC_SYMBOLS_H */\n"; "#endif /* __VLC_SYMBOLS_H */\n";
close $new_sym; close $new_sym;
......
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