Skip to content

Commit 93dfdab

Browse files
committed
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
1 parent fd5db1b commit 93dfdab

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

libxo/xo.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#ifndef INCLUDE_XO_H
2121
#define INCLUDE_XO_H
2222

23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif /* __cplusplus */
26+
2327
#include <stdio.h>
2428
#include <sys/types.h>
2529
#include <stdarg.h>
@@ -736,4 +740,8 @@ xo_map_add_file (xo_handle_t *xop, const char *fname);
736740
int
737741
xo_filter_add (xo_handle_t *xop, const char *vp);
738742

743+
#ifdef __cplusplus
744+
}
745+
#endif /* __cplusplus */
746+
739747
#endif /* INCLUDE_XO_H */

libxo/xo_encoder.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#ifndef XO_ENCODER_H
1919
#define XO_ENCODER_H
2020

21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif /* __cplusplus */
24+
2125
#include <string.h>
2226

2327
#include "xo_private.h"
@@ -208,4 +212,8 @@ xo_whiteboard_op_name (xo_whiteboard_op_t op);
208212
void
209213
xo_failure (xo_handle_t *xop, const char *fmt, ...);
210214

215+
#ifdef __cplusplus
216+
}
217+
#endif /* __cplusplus */
218+
211219
#endif /* XO_ENCODER_H */

0 commit comments

Comments
 (0)