Skip to content

Commit 9ff27a6

Browse files
committed
add extern C
1 parent bb95535 commit 9ff27a6

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

benchrunner/cxx/benchmarks.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ void *cilksort_par(void *const pbase, size_t total_elems, size_t size, __compar_
2929
template <typename T> T *bottomUpMergeSort(T *a, T *b, int n);
3030

3131
// Relating to C++ templatized versions
32-
int64_t *bottom_up_merge_sort_cxx_int(int64_t *pbase, size_t total_elems);
33-
int64_t *insertionsort_cxx_int(int64_t *pbase, size_t total_elems);
34-
int64_t *quicksort_cxx_int(int64_t *pbase, size_t total_elems);
32+
extern "C" {
33+
extern int64_t *bottom_up_merge_sort_cxx_int(int64_t *pbase, size_t total_elems);
34+
extern int64_t *insertionsort_cxx_int(int64_t *pbase, size_t total_elems);
35+
extern int64_t *quicksort_cxx_int(int64_t *pbase, size_t total_elems);
36+
}
3537

3638
// Microbenchmarks.
3739
int64_t* __attribute__ ((noinline)) fill_array_seq(size_t total_elems, int64_t val);

benchrunner/cxx/insertionsort_int_wrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include "insertionsort.cpp"
33

44

5-
int64_t *insertionsort_cxx_int(int64_t *pbase, size_t total_elems);
6-
7-
int64_t *insertionsort_cxx_int(int64_t *pbase, size_t total_elems){
5+
extern "C" {
6+
extern int64_t *insertionsort_cxx_int(int64_t *pbase, size_t total_elems){
87
return insertionsort_inplace<int64_t>(pbase, total_elems);
98
}
9+
}

benchrunner/cxx/mergesort_int_wrapper.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
#include "mergesort.cpp"
33

44

5-
int64_t *bottom_up_merge_sort_cxx_int(int64_t *pbase, size_t total_elems){
5+
extern "C" {
6+
7+
extern int64_t *bottom_up_merge_sort_cxx_int(int64_t *pbase, size_t total_elems){
68

79
int64_t *copy_pbase = new int64_t[total_elems];
810
copyArray<int64_t>(pbase, copy_pbase, total_elems);
911
return bottomUpMergeSort<int64_t>(pbase, copy_pbase, total_elems);
1012
}
13+
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#include "benchmarks.h"
22
#include "quicksort.cpp"
33

4-
int64_t *quicksort_cxx_int(int64_t *pbase, size_t total_elems){
4+
extern "C" {
5+
6+
extern int64_t *quicksort_cxx_int(int64_t *pbase, size_t total_elems){
57
return quicksort_inplace<int64_t>(pbase, total_elems);
68
}
9+
}

0 commit comments

Comments
 (0)