[vlc-devel] [PATCH 1/2] bank: enable static modules for mach-o binaries

Alexandre Janniaux ajanni at videolabs.io
Thu Mar 5 19:25:25 CET 2020

Static modules are available by overriding the vlc_static_modules
symbol in the executable. To avoid exposing this feature by forcing the
user to declare this symbol regardless of whether it was needed or not,
it was only defined on ELF binaries which supports the weak attributes
or when dynamic plugins are disabled as it becomes the only (thus
mandatory) way to define plugins.

Mach-O objects are also capable to define weak symbols, like defined
for the VLC_WEAK symbol in the vlc_common.h file so also allow this
mechanism when producing Mach-O objects.

It is particularly useful to ship battery-included LibVLC builds and
still allow external plugins in paths controlled by the application
using the library.
 src/modules/bank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/modules/bank.c b/src/modules/bank.c
index 36c4b30cdd..e8c956ebe6 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -172,7 +172,7 @@ static vlc_plugin_t *module_InitStatic(vlc_plugin_cb entry)
     return lib;
-#if defined(__ELF__) || !HAVE_DYNAMIC_PLUGINS
+#if defined(__ELF__) || defined(__MACH__) || !HAVE_DYNAMIC_PLUGINS
 extern vlc_plugin_cb vlc_static_modules[];

More information about the vlc-devel mailing list