From 3ae001a063b3a2f2e039e45200da473b152263e8 Mon Sep 17 00:00:00 2001
From: Mikael Djurfeldt <mikael@djurfeldt.com>
Date: Mon, 22 Jun 2015 18:50:24 +0200
Subject: [PATCH] Fixed an error with type MPI_Message missing for older
 versions of MPI and newer versions of mpi4py.

---
 pymusic/mpi_compat.h | 6 ++++++
 pymusic/pybuffer.pxd | 5 +++++
 pymusic/pymusic.pxd  | 5 +++++
 3 files changed, 16 insertions(+)
 create mode 100644 pymusic/mpi_compat.h

diff --git a/pymusic/mpi_compat.h b/pymusic/mpi_compat.h
new file mode 100644
index 0000000..6b9f4b4
--- /dev/null
+++ b/pymusic/mpi_compat.h
@@ -0,0 +1,6 @@
+#include <mpi.h>
+
+#if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message)
+typedef void *PyMPI_MPI_Message;
+#define MPI_Message PyMPI_MPI_Message
+#endif
diff --git a/pymusic/pybuffer.pxd b/pymusic/pybuffer.pxd
index f789c25..94aa5c6 100644
--- a/pymusic/pybuffer.pxd
+++ b/pymusic/pybuffer.pxd
@@ -1,3 +1,8 @@
+# The following include is needed to define a missing type MPI_Message
+# which is lacking for a certain combination of MPI and mpi4py versions
+cdef extern from "mpi_compat.h":
+    pass
+
 cimport mpi4py.MPI as MPI
 from mpi4py.mpi_c cimport *
 
diff --git a/pymusic/pymusic.pxd b/pymusic/pymusic.pxd
index dccdc76..bf8261e 100644
--- a/pymusic/pymusic.pxd
+++ b/pymusic/pymusic.pxd
@@ -1,3 +1,8 @@
+# The following include is needed to define a missing type MPI_Message
+# which is lacking for a certain combination of MPI and mpi4py versions
+cdef extern from "mpi_compat.h":
+    pass
+
 cimport mpi4py.MPI as MPI
 from mpi4py.mpi_c cimport *
 
-- 
GitLab