[vlc-devel] [PATCH] vlc_plugin: make sure the module name is used as a C symbol in C++ modules

Steve Lhomme robux4 at videolabs.io
Tue Nov 21 15:04:09 CET 2017


This can mess linking when mixing C in C++ modules
---
 include/vlc_messages.h | 6 ++++++
 include/vlc_plugin.h   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/vlc_messages.h b/include/vlc_messages.h
index 63f9476cd5..15912057b0 100644
--- a/include/vlc_messages.h
+++ b/include/vlc_messages.h
@@ -86,7 +86,13 @@ VLC_API void vlc_vaLog(vlc_object_t *obj, int prio, const char *module,
 #define msg_Dbg(p_this, ...) \
     msg_Generic(p_this, VLC_MSG_DBG, __VA_ARGS__)
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 extern const char vlc_module_name[];
+#ifdef __cplusplus
+}
+#endif
 
 VLC_API const char *vlc_strerror(int);
 VLC_API const char *vlc_strerror_c(int);
diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index ce28562726..801402e26c 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -212,7 +212,7 @@ enum vlc_module_properties
 #ifdef __PLUGIN__
 # define __VLC_SYMBOL( symbol  ) CONCATENATE( symbol, MODULE_SYMBOL )
 # define VLC_MODULE_NAME_HIDDEN_SYMBOL \
-    const char vlc_module_name[] = MODULE_STRING;
+    EXTERN_SYMBOL const char vlc_module_name[] = MODULE_STRING;
 #else
 # define __VLC_SYMBOL( symbol )  CONCATENATE( symbol, MODULE_NAME )
 # define VLC_MODULE_NAME_HIDDEN_SYMBOL
-- 
2.14.2



More information about the vlc-devel mailing list