Skip to content

Commit

Permalink
Use extern "C" linkage when compiling under C++
Browse files Browse the repository at this point in the history
  • Loading branch information
dglmoore committed Oct 23, 2017
1 parent d69bbbb commit 4f2bf17
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/ginger/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
#include <stdlib.h>
#include <string.h>

#ifdef __cplusplus
extern "C"
{
#endif

struct unit
{
char const *name;
Expand Down Expand Up @@ -338,3 +343,7 @@ inline static void assert_dbl_array_near(double *exp, double *real, size_t n, do
assert_dbl_near(exp[i], real[i], tol, caller, line);
}
}

#ifdef __cplusplus
}
#endif
9 changes: 9 additions & 0 deletions include/ginger/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#include <stdio.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C"
{
#endif

struct gvector_header
{
size_t capacity;
Expand Down Expand Up @@ -44,3 +49,7 @@ if (v) { v[gvector_len(v)++] = x; } else { raise(SIGSEGV); }
{ \
for (size_t i = 0; i < gvector_len(v); ++i) printf(fmt, v[i]); \
} while(0);

#ifdef __cplusplus
}
#endif

0 comments on commit 4f2bf17

Please sign in to comment.