Skip to content

Commit 0a33bdd

Browse files
committed
add extern "C" stuff to C header files to support C++ including (proposal #4, reported by Markus Elfring @elfring)
1 parent a3b9c3b commit 0a33bdd

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

aco.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@
2424
#include <time.h>
2525
#include <sys/mman.h>
2626

27-
#define ACO_VERSION_MAJOR 1
28-
#define ACO_VERSION_MINOR 2
29-
#define ACO_VERSION_PATCH 2
30-
3127
#ifdef ACO_USE_VALGRIND
3228
#include <valgrind/valgrind.h>
3329
#endif
3430

31+
#ifdef __cplusplus
32+
extern "C" {
33+
#endif
34+
35+
#define ACO_VERSION_MAJOR 1
36+
#define ACO_VERSION_MINOR 2
37+
#define ACO_VERSION_PATCH 2
38+
3539
#ifdef __i386__
3640
#define ACO_REG_IDX_RETADDR 0
3741
#define ACO_REG_IDX_SP 1
@@ -196,4 +200,8 @@ extern void aco_destroy(aco_t* co);
196200
aco_exit1(aco_gtls_co); \
197201
} while(0)
198202

203+
#ifdef __cplusplus
204+
}
205+
#endif
206+
199207
#endif

aco_assert_override.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@
1717

1818
#include "aco.h"
1919

20+
#ifdef __cplusplus
21+
extern "C" {
22+
#endif
23+
2024
#define likely(x) aco_likely(x)
2125
#define unlikely(x) aco_unlikely(x)
2226
#define assert(EX) aco_assert(EX)
2327
#define assertptr(ptr) aco_assertptr(ptr)
2428
#define assertalloc_bool(b) aco_assertalloc_bool(b)
2529
#define assertalloc_ptr(ptr) aco_assertalloc_ptr(ptr)
2630

31+
#ifdef __cplusplus
32+
}
33+
#endif
34+
2735
#endif

0 commit comments

Comments
 (0)