diff vampyhost.cpp @ 14:8565ec421f9c

Build fixes -- avoid undefined symbol VAMPY_ARRAY_API
author Chris Cannam
date Mon, 24 Nov 2014 10:11:46 +0000
parents d0d91312e5a2
children 8b264cabbc28
line wrap: on
line diff
--- a/vampyhost.cpp	Thu Nov 20 13:04:36 2014 +0000
+++ b/vampyhost.cpp	Mon Nov 24 10:11:46 2014 +0000
@@ -2,9 +2,16 @@
 
 //include for python extension module: must be first
 #include <Python.h>
+
+// define a unique API pointer 
+#define PY_ARRAY_UNIQUE_SYMBOL VAMPY_ARRAY_API
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
+#include "numpy/arrayobject.h"
+
 #include <vampyhost.h>
 
-#include <PyRealTime.h>
+#include "PyTypeConversions.h"
+#include "PyRealTime.h"
 
 //!!! NB all our NumPy stuff is currently using the deprecated API --
 //!!! need to work out how to update this
@@ -12,8 +19,6 @@
 
 #define HAVE_NUMPY 1 // Required
 
-#include "PyTypeConversions.h"
-
 //includes for vamp host
 #include "vamp-hostsdk/Plugin.h"
 #include "vamp-hostsdk/PluginHostAdapter.h"
@@ -626,6 +631,8 @@
 //Documentation for our new module
 PyDoc_STRVAR(module_doc, "This is a template module just for instruction.");
 
+
+
 /* Initialization function for the module (*must* be called initxx) */
 
 //module initialization (includes extern C {...} as necessary)
@@ -646,6 +653,8 @@
     m = Py_InitModule3("vampyhost", vampyhost_methods, module_doc);
     if (m == NULL) return;
 
+    import_array();
+
     // PyModule_AddObject(m, "realtime", (PyObject *)&RealTime_Type);
 
 }