From 7005bc966d9b167b1b70f95a1e5bf1f873f93e54 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 9 Nov 2016 12:29:06 -0500 Subject: [PATCH] barectf.h: add __cplusplus check Signed-off-by: Philippe Proulx --- barectf/templates.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/barectf/templates.py b/barectf/templates.py index fcc90ef..bf00f27 100644 --- a/barectf/templates.py +++ b/barectf/templates.py @@ -263,6 +263,10 @@ _HEADER_BEGIN = '''#ifndef _{ucprefix}H #include "{bitfield_header_filename}" +#ifdef __cplusplus +extern "C" {{ +#endif + {prefix_def} {default_stream_def} @@ -280,7 +284,12 @@ uint32_t {prefix}packet_buf_size(void *ctx); int {prefix}packet_is_open(void *ctx);''' -_HEADER_END = '#endif /* _{ucprefix}H */' +_HEADER_END = '''#ifdef __cplusplus +}} +#endif + +#endif /* _{ucprefix}H */ +''' _C_SRC = '''/* -- 2.34.1