[vlc-devel] [PATCH] Support static modules using extern NULL-terminated list
Rafaël Carré
rafael.carre at gmail.com
Thu Aug 25 04:13:53 CEST 2011
---
src/modules/bank.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/modules/bank.c b/src/modules/bank.c
index b001d1b..dc640bb 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -71,6 +71,22 @@ static void module_StoreBank (module_t *module)
modules.head = module;
}
+#ifdef __GNUC__
+__attribute__((weak)) vlc_plugin_cb vlc_static_modules[];
+#else
+#pragma weak vlc_static_modules;
+#endif
+vlc_plugin_cb vlc_static_modules[] = { NULL };
+
+static void module_InitStaticModules(void)
+{
+ for (unsigned i = 0; vlc_static_modules[i]; i++) {
+ module_t *module = module_InitStatic (vlc_static_modules[i]);
+ if (likely(module != NULL))
+ module_StoreBank (module);
+ }
+}
+
/**
* Init bank
*
@@ -92,6 +108,7 @@ void module_InitBank (void)
if (likely(module != NULL))
module_StoreBank (module);
+ module_InitStaticModules();
config_SortConfig ();
}
modules.usage++;
--
1.7.5.4
More information about the vlc-devel
mailing list