X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fe304706848f0a64477d4687b3ea97d5b9a0c35c..53b88680c91bba523830793ce69bb8a0fab54382:/src/smpi/bindings/smpi_f77_comm.cpp?ds=sidebyside diff --git a/src/smpi/bindings/smpi_f77_comm.cpp b/src/smpi/bindings/smpi_f77_comm.cpp index 8e3c44c200..afca7860ab 100644 --- a/src/smpi/bindings/smpi_f77_comm.cpp +++ b/src/smpi/bindings/smpi_f77_comm.cpp @@ -5,6 +5,7 @@ #include "private.hpp" #include "smpi_comm.hpp" +#include "smpi_errhandler.hpp" #include "smpi_info.hpp" extern "C" { // This should really use the C linkage to be usable from Fortran @@ -100,9 +101,8 @@ void mpi_comm_free_keyval_ (int* keyval, int* ierr) { void mpi_comm_get_name_ (int* comm, char* name, int* len, int* ierr){ *ierr = MPI_Comm_get_name(simgrid::smpi::Comm::f2c(*comm), name, len); - if(*len>0) - for(int i = *len; i(errhandler)); +void mpi_comm_set_errhandler_ (int* comm, int* errhandler, int* ierr) { + *ierr = MPI_Errhandler_set(simgrid::smpi::Comm::f2c(*comm), simgrid::smpi::Errhandler::f2c(*errhandler)); } -void mpi_comm_get_errhandler_ (int* comm, void* errhandler, int* ierr) { - *ierr = MPI_Errhandler_set(simgrid::smpi::Comm::f2c(*comm), static_cast(errhandler)); +void mpi_comm_get_errhandler_ (int* comm, int* errhandler, int* ierr) { + MPI_Errhandler tmp; + *ierr = MPI_Errhandler_get(simgrid::smpi::Comm::f2c(*comm), &tmp); + if(*ierr == MPI_SUCCESS) { + *errhandler = tmp->c2f(); + } } void mpi_comm_test_inter_ (int* comm, int* flag, int* ierr) { @@ -181,8 +185,12 @@ void mpi_comm_get_info_ (int* comm, int* info, int* ierr){ } } -void mpi_comm_create_errhandler_ ( void *function, void *errhandler, int* ierr){ - *ierr = MPI_Comm_create_errhandler( reinterpret_cast(function), static_cast(errhandler)); +void mpi_comm_create_errhandler_ ( void *function, int *errhandler, int* ierr){ + MPI_Errhandler tmp; + *ierr = MPI_Comm_create_errhandler( reinterpret_cast(function), &tmp); + if(*ierr==MPI_SUCCESS){ + *errhandler = tmp->c2f(); + } } void mpi_comm_call_errhandler_ (int* comm,int* errorcode, int* ierr){