changeset 493:25e023bad200

Choose another method (which should actually work) to override linkage for KissFFT
author Chris Cannam
date Sun, 05 Mar 2017 17:13:18 +0000
parents fb3e0ca3e700
children 910a475b5bc4
files src/vamp-sdk/FFTimpl.cpp src/vamp-sdk/ext/kiss_fft.h src/vamp-sdk/ext/kiss_fftr.h
diffstat 3 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/vamp-sdk/FFTimpl.cpp	Fri Feb 24 15:46:22 2017 +0000
+++ b/src/vamp-sdk/FFTimpl.cpp	Sun Mar 05 17:13:18 2017 +0000
@@ -2,7 +2,7 @@
 // Override C linkage for KissFFT headers. So long as we have already
 // included all of the other (system etc) headers KissFFT depends on,
 // this should work out OK
-#undef __cplusplus
+#define KISSFFT_USE_CPP_LINKAGE 1
 
 namespace Kiss {
 
@@ -30,3 +30,9 @@
 
 }
 
+// Check that this worked, i.e. that we have our own suitably
+// hacked KissFFT header which set this after making the
+// appropriate change
+#ifndef KISSFFT_USED_CPP_LINKAGE
+#error "KissFFT header lacks specific linkage adjustment needed for Vamp SDK"
+#endif
--- a/src/vamp-sdk/ext/kiss_fft.h	Fri Feb 24 15:46:22 2017 +0000
+++ b/src/vamp-sdk/ext/kiss_fft.h	Sun Mar 05 17:13:18 2017 +0000
@@ -6,9 +6,11 @@
 #include <math.h>
 #include <string.h>
 
+#ifndef KISSFFT_USE_CPP_LINKAGE
 #ifdef __cplusplus
 extern "C" {
 #endif
+#endif
 
 /*
  ATTENTION!
@@ -117,8 +119,14 @@
 #define kiss_fftr_next_fast_size_real(n) \
         (kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
 
+#ifndef KISSFFT_USE_CPP_LINKAGE
 #ifdef __cplusplus
 } 
 #endif
+#endif
+
+#ifdef KISSFFT_USE_CPP_LINKAGE
+#define KISSFFT_USED_CPP_LINKAGE 1
+#endif
 
 #endif
--- a/src/vamp-sdk/ext/kiss_fftr.h	Fri Feb 24 15:46:22 2017 +0000
+++ b/src/vamp-sdk/ext/kiss_fftr.h	Sun Mar 05 17:13:18 2017 +0000
@@ -2,9 +2,12 @@
 #define KISS_FTR_H
 
 #include "kiss_fft.h"
+
+#ifndef KISSFFT_USE_CPP_LINKAGE
 #ifdef __cplusplus
 extern "C" {
 #endif
+#endif
 
     
 /* 
@@ -40,7 +43,14 @@
 
 #define kiss_fftr_free free
 
+#ifndef KISSFFT_USE_CPP_LINKAGE
 #ifdef __cplusplus
 }
 #endif
 #endif
+
+#ifdef KISSFFT_USE_CPP_LINKAGE
+#define KISSFFT_USED_CPP_LINKAGE 1
+#endif
+
+#endif