From: Sebastian Harl Date: Sun, 11 Jan 2009 14:23:28 +0000 (+0100) Subject: libcollectdclient: Added LCC_{BEGIN,END}_DECLS macros. X-Git-Tag: collectd-4.6.0~108 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c4a60d6cec0a5fd961a3fd2dda2c9128e47a38e0;p=collectd.git libcollectdclient: Added LCC_{BEGIN,END}_DECLS macros. These macros define an extern "C" block when using C++. This allows to use the headers from C++ as well. --- diff --git a/src/libcollectdclient/client.h b/src/libcollectdclient/client.h index 41fe8d7a..d5371fb2 100644 --- a/src/libcollectdclient/client.h +++ b/src/libcollectdclient/client.h @@ -22,6 +22,8 @@ #ifndef LIBCOLLECTD_COLLECTDCLIENT_H #define LIBCOLLECTD_COLLECTDCLIENT_H 1 +#include "lcc_features.h" + /* * Includes (for data types) */ @@ -41,6 +43,8 @@ #define LCC_TYPE_COUNTER 0 #define LCC_TYPE_GAUGE 1 +LCC_BEGIN_DECLS + typedef uint64_t counter_t; typedef double gauge_t; @@ -104,5 +108,7 @@ int lcc_identifier_to_string (lcc_connection_t *c, int lcc_string_to_identifier (lcc_connection_t *c, lcc_identifier_t *ident, const char *string); +LCC_END_DECLS + /* vim: set sw=2 sts=2 et : */ #endif /* LIBCOLLECTD_COLLECTDCLIENT_H */ diff --git a/src/libcollectdclient/lcc_features.h.in b/src/libcollectdclient/lcc_features.h.in index 844e6012..3916a179 100644 --- a/src/libcollectdclient/lcc_features.h.in +++ b/src/libcollectdclient/lcc_features.h.in @@ -22,6 +22,14 @@ #ifndef LIBCOLLECTD_LCC_FEATURES_H #define LIBCOLLECTD_LCC_FEATURES_H 1 +#ifdef __cplusplus +# define LCC_BEGIN_DECLS extern "C" { +# define LCC_END_DECLS } +#else +# define LCC_BEGIN_DECLS +# define LCC_END_DECLS +#endif + #define LCC_API_VERSION 0 #define LCC_VERSION_MAJOR @LCC_VERSION_MAJOR@ @@ -38,12 +46,16 @@ #define LCC_VERSION \ LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH) +LCC_BEGIN_DECLS + unsigned int lcc_version (void); const char *lcc_version_string (void); const char *lcc_version_extra (void); +LCC_END_DECLS + #endif /* ! LIBCOLLECTD_LCC_FEATURES_H */ /* vim: set sw=4 ts=4 tw=78 noexpandtab : */