Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Unexpected compile error setting FILE_NULL Errhandler using C++ Bindings
From: Eidson, Eric D (edeidso_at_[hidden])
Date: 2008-03-20 12:54:45


Hello,

OpenMPI 1.2.5 and earlier do not let you set the Errhandler for
MPI::FILE_NULL using the C++ bindings.

[You would want to do so because, on error, MPI::File::Open() and
MPI::File::Delete() call the Errhandler associated with FILE_NULL.]

With the C++ bindings, MPI::FILE_NULL is a const object, and Set_errhandler
is apparently a non-const function -- so compiling fails.

Eric

--
#include <mpi.h>
int
main()
{
  MPI::Init();
  MPI::Errhandler oldeh = MPI::FILE_NULL.Get_errhandler();
  MPI::FILE_NULL.Set_errhandler(MPI::ERRORS_THROW_EXCEPTIONS);
  MPI::FILE_NULL.Set_errhandler(oldeh);
  MPI::Finalize();
}