From 93dfdab44086a855557ebbbe4978f43c6f43920b Mon Sep 17 00:00:00 2001 From: SHENGYI HUNG Date: Thu, 5 Dec 2024 22:05:12 +0800 Subject: [PATCH] libxo/*.h fix libxo header include when the source is C++ C++ needs extern C to disable C++ name mangling. To use libxo in C++ it is better to include extern "C" guardian --- libxo/xo.h | 8 ++++++++ libxo/xo_encoder.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/libxo/xo.h b/libxo/xo.h index 2c13afde..268a5247 100644 --- a/libxo/xo.h +++ b/libxo/xo.h @@ -20,6 +20,10 @@ #ifndef INCLUDE_XO_H #define INCLUDE_XO_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #include #include #include @@ -736,4 +740,8 @@ xo_map_add_file (xo_handle_t *xop, const char *fname); int xo_filter_add (xo_handle_t *xop, const char *vp); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* INCLUDE_XO_H */ diff --git a/libxo/xo_encoder.h b/libxo/xo_encoder.h index 70f1ecc5..619e330b 100644 --- a/libxo/xo_encoder.h +++ b/libxo/xo_encoder.h @@ -18,6 +18,10 @@ #ifndef XO_ENCODER_H #define XO_ENCODER_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #include #include "xo_private.h" @@ -208,4 +212,8 @@ xo_whiteboard_op_name (xo_whiteboard_op_t op); void xo_failure (xo_handle_t *xop, const char *fmt, ...); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* XO_ENCODER_H */