barectf.h: add __cplusplus check
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 9 Nov 2016 17:29:06 +0000 (12:29 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 9 Nov 2016 17:34:08 +0000 (12:34 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/templates.py

index fcc90ef724e3e2573a56b8de97f73594658d6136..bf00f27aa1016dea6b6268be64acb84f37b32a7f 100644 (file)
@@ -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 = '''/*
This page took 0.037268 seconds and 4 git commands to generate.