Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_create.cpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_create.cpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_create.cpp	(revision 1356)
@@ -179,5 +179,5 @@
   
   
-  int MPI_Comm_create_endpoints(int* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls)
+  int MPI_Comm_create_endpoints(void* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls)
   {
 
@@ -200,5 +200,5 @@
       out_comm_hdls[idx].is_intercomm = false;
       out_comm_hdls[idx].ep_comm_ptr = new ep_communicator;     
-      *(out_comm_hdls[idx].mpi_comm) = *base_comm_ptr;
+      *(static_cast< ::MPI_Comm*>(out_comm_hdls[idx].mpi_comm)) = *(static_cast< ::MPI_Comm*>(base_comm_ptr));
       out_comm_hdls[idx].ep_comm_ptr->comm_list = out_comm_hdls;
       out_comm_hdls[idx].ep_comm_ptr->comm_label = 0;
Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_free.cpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_free.cpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_free.cpp	(revision 1356)
@@ -80,4 +80,5 @@
 
       }
+
       return 0;
     }
@@ -142,14 +143,16 @@
       }
 
-      // if(comm->ep_comm_ptr->intercomm->mpi_inter_comm != MPI_COMM_NULL_STD)
-      // {
-         // ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->ep_comm_ptr->comm_list->ep_comm_ptr->intercomm->mpi_inter_comm);
-         // ::MPI_Comm_free(&mpi_comm);
-      //   Debug("mpi_intercomm freed\n");
-      // }
+      if(comm->ep_comm_ptr->intercomm->mpi_inter_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm))
+      {
+        ::MPI_Comm mpi_comm = to_mpi_comm(comm->ep_comm_ptr->comm_list->ep_comm_ptr->intercomm->mpi_inter_comm);
+        ::MPI_Comm_free(&mpi_comm);
+        Debug("mpi_intercomm freed\n");
+      }
 
      if(comm != NULL) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");}
 
     }
+
+    
     
     return 0;
Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_intercomm_world.cpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_intercomm_world.cpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_intercomm_world.cpp	(revision 1356)
@@ -538,5 +538,5 @@
 
   // #elif _intelmpi
-  int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, int* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm)
+  int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, void* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm)
   {
     int ep_rank, ep_rank_loc, mpi_rank;
Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp	(revision 1356)
@@ -246,7 +246,7 @@
 }
 
-MPI_Comm to_mpi_comm(int* comm)
+MPI_Comm to_mpi_comm(void* comm)
 {
-  return static_cast< MPI_Comm >(*comm);
+  return *(static_cast< MPI_Comm* >(comm));
 }  
 
Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.hpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.hpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.hpp	(revision 1356)
@@ -49,5 +49,5 @@
   // #endif
   
-  int MPI_Comm_create_endpoints(int* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from EP to create endpoints
+  int MPI_Comm_create_endpoints(void* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from EP to create endpoints
 
   int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm);
Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_intercomm.hpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_intercomm.hpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_intercomm.hpp	(revision 1356)
@@ -41,5 +41,5 @@
   // #endif
 
-  int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, int* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm);
+  int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, void* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm);
   
   int MPI_Intercomm_create_unique_leader(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm);
Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_mpi.hpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_mpi.hpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_mpi.hpp	(revision 1356)
@@ -6,5 +6,5 @@
 MPI_Datatype to_mpi_type(ep_lib::MPI_Datatype type);
 MPI_Op       to_mpi_op(ep_lib::MPI_Op op);
-MPI_Comm     to_mpi_comm(int* comm);
+MPI_Comm     to_mpi_comm(void* comm);
 
 #endif // EP_MPI_HPP_INCLUDED
Index: /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp
===================================================================
--- /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp	(revision 1356)
@@ -134,5 +134,5 @@
     public:
 
-    int *mpi_inter_comm;
+    void *mpi_inter_comm;
 
     RANK_MAP *intercomm_rank_map;
@@ -148,4 +148,5 @@
 
     ep_intercomm();
+    //~ep_intercomm(){delete mpi_inter_comm;}
     bool operator == (ep_intercomm right);
     bool operator != (ep_intercomm right);
@@ -197,5 +198,5 @@
     OMPbarrier *ep_barrier;
     RANK_MAP   *rank_map;
-    int* mpi_comm;
+    void* mpi_comm;
     EP_Comm ep_comm_ptr;
     MPI_Comm *mem_bridge;
@@ -203,6 +204,6 @@
 
     MPI_Comm();  
-    //MPI_Comm(const MPI_Comm &comm);
-    MPI_Comm(int* comm);
+    MPI_Comm(void* comm);
+    //~MPI_Comm(){delete mpi_comm;}
 
 
Index: /XIOS/dev/branch_openmp/src/context_client.cpp
===================================================================
--- /XIOS/dev/branch_openmp/src/context_client.cpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/src/context_client.cpp	(revision 1356)
@@ -27,7 +27,7 @@
       intraComm = intraComm_;
       interComm = interComm_;
-      *(intraComm.mpi_comm) = *(intraComm_.mpi_comm);
-      *(interComm.mpi_comm) = *(interComm_.mpi_comm);
-      *(interComm.ep_comm_ptr->intercomm->mpi_inter_comm) = *(interComm_.ep_comm_ptr->intercomm->mpi_inter_comm);
+      *(static_cast< ::MPI_Comm* >(intraComm.mpi_comm)) = *(static_cast< ::MPI_Comm* >(intraComm_.mpi_comm));
+      *(static_cast< ::MPI_Comm* >(interComm.mpi_comm)) = *(static_cast< ::MPI_Comm* >(interComm_.mpi_comm));
+      *(static_cast< ::MPI_Comm* >(interComm.ep_comm_ptr->intercomm->mpi_inter_comm)) = *(static_cast< ::MPI_Comm* >(interComm_.ep_comm_ptr->intercomm->mpi_inter_comm));
       //MPI_Comm_dup(intraComm_, &intraComm);
       //MPI_Comm_dup(interComm_, &interComm);
Index: /XIOS/dev/branch_openmp/src/io/inetcdf4.cpp
===================================================================
--- /XIOS/dev/branch_openmp/src/io/inetcdf4.cpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/src/io/inetcdf4.cpp	(revision 1356)
@@ -23,5 +23,5 @@
     // even if Parallel NetCDF ends up being used.
     if (mpi)
-      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, static_cast<MPI_Comm>(*(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
+      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *(static_cast<MPI_Comm*>(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
       //CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *(static_cast<MPI_Comm*>(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
     else
Index: /XIOS/dev/branch_openmp/src/io/onetcdf4.cpp
===================================================================
--- /XIOS/dev/branch_openmp/src/io/onetcdf4.cpp	(revision 1355)
+++ /XIOS/dev/branch_openmp/src/io/onetcdf4.cpp	(revision 1356)
@@ -58,5 +58,5 @@
             CTimer::get("Files : create").resume();
             if (wmpi)
-               CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(*(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
+               CNetCdfInterface::createPar(filename, mode, *(static_cast<MPI_Comm*>(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
                //CNetCdfInterface::createPar(filename, mode, *(static_cast<MPI_Comm*>(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
             else
@@ -71,5 +71,5 @@
             CTimer::get("Files : open").resume();
             if (wmpi)
-               CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(*(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
+               CNetCdfInterface::openPar(filename, mode, *(static_cast<MPI_Comm*>(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
                //CNetCdfInterface::openPar(filename, mode, *(static_cast<MPI_Comm*>(comm->mpi_comm)), info_null.mpi_info, this->ncidp);
             else
