summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Meier <cm@trexity.de>2008-09-09 12:11:37 +0200
committerJulien Danjou <julien@danjou.info>2008-09-09 15:00:38 +0200
commit9afadd2aef8af89a4f4ab70baeae0b848904c367 (patch)
treede2014619e0a1d0fbe216c23f280e457ca51e29d
parent25e59ccc0dc8baf344145d6d739229e8120330db (diff)
Added generation of extern "C" for compatibility with C++
The auto-generated header files now include an extern "C" declaration for compatibility with C++. Signed-off-by: Julien Danjou <julien@danjou.info>
-rwxr-xr-xsrc/c_client.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/c_client.py b/src/c_client.py
index d634c27..99fe114 100755
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -176,6 +176,12 @@ def c_open(self):
for (n, h) in self.imports:
_hc('#include "%s.h"', h)
+ _h('')
+ _h('#ifdef __cplusplus')
+ _h('extern "C" {')
+ _h('#endif')
+
+ if _ns.is_ext:
_h('')
_h('#define XCB_%s_MAJOR_VERSION %s', _ns.ext_name.upper(), _ns.major_version)
_h('#define XCB_%s_MINOR_VERSION %s', _ns.ext_name.upper(), _ns.minor_version)
@@ -193,6 +199,12 @@ def c_close(self):
_h_setlevel(2)
_c_setlevel(2)
_hc('')
+
+ _h('')
+ _h('#ifdef __cplusplus')
+ _h('}')
+ _h('#endif')
+
_h('')
_h('#endif')
_h('')