changeset 1027:bab959e4a55a

lib: add extern C {} for those who write C++ plugins
author David Demelier <markand@malikania.fr>
date Wed, 24 Feb 2021 18:14:02 +0100
parents 724ecacb5a17
children 98791cc6b4b4
files lib/CMakeLists.txt lib/irccd/channel.h lib/irccd/conn.h lib/irccd/event.h lib/irccd/hook.h lib/irccd/irccd.h lib/irccd/log.h lib/irccd/plugin.h lib/irccd/rule.h lib/irccd/server.h lib/irccd/subst.h lib/irccd/util.h
diffstat 12 files changed, 89 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/CMakeLists.txt	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/CMakeLists.txt	Wed Feb 24 18:14:02 2021 +0100
@@ -23,6 +23,7 @@
 set(
 	HEADERS
 	irccd/channel.h
+	irccd/conn.h
 	irccd/event.h
 	irccd/hook.h
 	irccd/irccd.h
--- a/lib/irccd/channel.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/channel.h	Wed Feb 24 18:14:02 2021 +0100
@@ -24,6 +24,10 @@
 
 #include "limits.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 struct irc_channel_user {
 	char nickname[IRC_NICKNAME_LEN];
 	int modes;
@@ -58,4 +62,8 @@
 void
 irc_channel_finish(struct irc_channel *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_CHANNEL_H */
--- a/lib/irccd/conn.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/conn.h	Wed Feb 24 18:14:02 2021 +0100
@@ -27,6 +27,10 @@
 
 #include "limits.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 struct addrinfo;
 struct pollfd;
 
@@ -101,4 +105,8 @@
 void
 irc_conn_finish(struct irc_conn *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_CONN_H */
--- a/lib/irccd/event.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/event.h	Wed Feb 24 18:14:02 2021 +0100
@@ -23,6 +23,10 @@
 
 #include "limits.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 struct irc_server;
 
 /*
@@ -148,4 +152,8 @@
 void
 irc_event_finish(struct irc_event *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_EVENT_H */
--- a/lib/irccd/hook.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/hook.h	Wed Feb 24 18:14:02 2021 +0100
@@ -24,6 +24,10 @@
 
 #include "limits.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 struct irc_event;
 
 struct irc_hook {
@@ -43,4 +47,8 @@
 void
 irc_hook_finish(struct irc_hook *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_HOOK_H */
--- a/lib/irccd/irccd.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/irccd.h	Wed Feb 24 18:14:02 2021 +0100
@@ -26,6 +26,10 @@
 #include "rule.h"
 #include "server.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 extern struct irc {
 	struct irc_server_list servers;
 	struct irc_plugin_list plugins;
@@ -115,4 +119,8 @@
 void
 irc_bot_finish(void);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_H */
--- a/lib/irccd/log.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/log.h	Wed Feb 24 18:14:02 2021 +0100
@@ -19,6 +19,10 @@
 #ifndef IRCCD_LOG_H
 #define IRCCD_LOG_H
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 void
 irc_log_to_syslog(void);
 
@@ -46,4 +50,8 @@
 void
 irc_log_finish(void);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_LOG_H */
--- a/lib/irccd/plugin.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/plugin.h	Wed Feb 24 18:14:02 2021 +0100
@@ -23,6 +23,10 @@
 
 #include "limits.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 struct irc_event;
 
 struct irc_plugin {
@@ -116,4 +120,8 @@
 void
 irc_plugin_loader_finish(struct irc_plugin_loader *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_PLUGIN_H */
--- a/lib/irccd/rule.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/rule.h	Wed Feb 24 18:14:02 2021 +0100
@@ -23,6 +23,10 @@
 
 #include "limits.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 enum irc_rule_action {
 	IRC_RULE_ACCEPT,
 	IRC_RULE_DROP
@@ -68,4 +72,8 @@
 void
 irc_rule_finish(struct irc_rule *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_RULE_H */
--- a/lib/irccd/server.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/server.h	Wed Feb 24 18:14:02 2021 +0100
@@ -27,6 +27,10 @@
 #include "event.h"
 #include "limits.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 struct pollfd;
 
 struct irc_conn;
@@ -178,4 +182,8 @@
 void
 irc_server_decref(struct irc_server *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_SERVER_H */
--- a/lib/irccd/subst.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/subst.h	Wed Feb 24 18:14:02 2021 +0100
@@ -23,6 +23,10 @@
 #include <stddef.h>
 #include <time.h>
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 enum irc_subst_flags {
 	IRC_SUBST_DATE          = (1 << 0),
 	IRC_SUBST_KEYWORDS      = (1 << 1),
@@ -47,4 +51,8 @@
 ssize_t
 irc_subst(char *, size_t, const char *, const struct irc_subst *);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_SUBST_H */
--- a/lib/irccd/util.h	Wed Feb 24 10:19:18 2021 +0100
+++ b/lib/irccd/util.h	Wed Feb 24 18:14:02 2021 +0100
@@ -21,6 +21,10 @@
 
 #include <stddef.h>
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 #define IRC_UTIL_SIZE(x) (sizeof (x) / sizeof (x[0]))
 
 /* Suitable convenient typedef for bsearch/qsort. */
@@ -59,4 +63,8 @@
 char *
 irc_util_printf(char *, size_t, const char *, ...);
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* !IRCCD_UTIL_H */