From 22f4773ee8fda1ddff6638b1e4da672488b8d135 Mon Sep 17 00:00:00 2001
From: Romain Forlot <romain.forlot@iot.bzh>
Date: Fri, 3 Nov 2017 15:42:50 +0100
Subject: Correctly export symbols for C++

Change-Id: I87eb6b5cc7208caaabbc3c2f3b6636d600c60370
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
---
 ctl-lib/ctl-config.h | 9 +++++++--
 ctl-lib/ctl-lua.h    | 7 +++++++
 ctl-lib/ctl-plugin.h | 7 +++++++
 ctl-lib/ctl-timer.h  | 8 ++++++++
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/ctl-lib/ctl-config.h b/ctl-lib/ctl-config.h
index a7b07b5..d6967bc 100644
--- a/ctl-lib/ctl-config.h
+++ b/ctl-lib/ctl-config.h
@@ -21,6 +21,10 @@
 #ifndef _CTL_CONFIG_INCLUDE_
 #define _CTL_CONFIG_INCLUDE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
@@ -93,8 +97,6 @@ PUBLIC int CtlConfigExec(AFB_ApiT apiHandle, CtlConfigT *ctlConfig) ;
 PUBLIC CtlConfigT *CtlLoadMetaData(AFB_ApiT apiHandle,const char* filepath) ;
 PUBLIC int CtlLoadSections(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, CtlSectionT *sections);
 
-
-
 // ctl-event.c
 PUBLIC int EventConfig(AFB_ApiT apihandle, CtlSectionT *section, json_object *actionsJ);
 #ifdef AFB_BINDING_PREV3
@@ -113,5 +115,8 @@ PUBLIC int OnloadConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *a
 PUBLIC int PluginConfig(AFB_ApiT UNUSED_ARG(apiHandle), CtlSectionT *section, json_object *pluginsJ);
 PUBLIC int PluginGetCB (AFB_ApiT apiHandle, CtlActionT *action , json_object *callbackJ);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _CTL_CONFIG_INCLUDE_ */
diff --git a/ctl-lib/ctl-lua.h b/ctl-lib/ctl-lua.h
index d0d89bd..3a70b71 100644
--- a/ctl-lib/ctl-lua.h
+++ b/ctl-lib/ctl-lua.h
@@ -21,6 +21,10 @@
 #ifndef _LUA_CTL_INCLUDE_
 #define _LUA_CTL_INCLUDE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
@@ -68,5 +72,8 @@ PUBLIC void ctlapi_lua_docall (afb_req request);
 PUBLIC void ctlapi_lua_dostring (afb_req request);
 PUBLIC void ctlapi_lua_doscript (afb_req request);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
diff --git a/ctl-lib/ctl-plugin.h b/ctl-lib/ctl-plugin.h
index 2adfbef..f4a0e7b 100644
--- a/ctl-lib/ctl-plugin.h
+++ b/ctl-lib/ctl-plugin.h
@@ -20,6 +20,9 @@
 #ifndef _CTL_PLUGIN_INCLUDE_
 #define _CTL_PLUGIN_INCLUDE_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
@@ -240,4 +243,8 @@ typedef int (*Lua2cWrapperT) (void*luaHandle, char *funcname, Lua2cFunctionT cal
         int lua2c_ ## funcname (void* luaState){return((*Lua2cWrap)(luaState, MACRO_STR_VALUE(funcname), funcname));};\
         static int funcname (CtlSourceT* source, json_object* argsJ, json_object** responseJ)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _CTL_PLUGIN_INCLUDE_ */
diff --git a/ctl-lib/ctl-timer.h b/ctl-lib/ctl-timer.h
index 333f172..4b06bdf 100644
--- a/ctl-lib/ctl-timer.h
+++ b/ctl-lib/ctl-timer.h
@@ -19,6 +19,10 @@
 #ifndef CTL_TIMER_INCLUDE
 #define CTL_TIMER_INCLUDE
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <systemd/sd-event.h>
 
 // ctl-timer.c
@@ -42,4 +46,8 @@ PUBLIC int TimerEvtInit (AFB_ApiT apiHandle);
 PUBLIC void TimerEvtStart(AFB_ApiT apiHandle, TimerHandleT *timerHandle, timerCallbackT callback, void *context);
 PUBLIC void TimerEvtStop(TimerHandleT *timerHandle);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif // CTL_TIMER_INCLUDE
-- 
cgit