Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] Can't compile C++ program with extern "C" { #include mpi.h }
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2008-01-30 21:21:07

On Jan 30, 2008, at 5:35 PM, Adam C Powell IV wrote:

> With no reply in a couple of weeks, I'm wondering if my previous
> message
> got dropped. (Then again, my previous message was a couple of weeks
> late in replying to its predecessor...)

No, it didn't get dropped -- it was exactly your admission of low
priority that had me put this issue as low priority as well. :-)

> I'm recommending a change to mpi.h which would let C headers
> included by
> C++ programs do:
> #include <mpi.h>
> without preventing the C++ headers from being included at another
> time.
> See below for the recommended change.

I really don't think that's a good solution. The real problem is that
some of Salome's header files are doing things that they should not be
doing (including a C++-safe header file inside extern "C" {}).

IMHO, the real fix should be to fix the code that is doing the Wrong
Thing. I'm reluctant to provide a subtle workaround in our software
that enables a Wrong Thing -- know what I mean?

FWIW, I just downloaded HDF5 1.6.6 and I took a [quick] look: it does
indeed look like HDF5's header files are C++-safe. Specifically: they
do not include <mpi.h> in an extern "C" block, and all of their
declarations are within extern "C" blocks. Hence, Salome should not
be including <hdf5.h> inside of an extern "C" block because <hdf5.h>
is already C++-safe.

This should fix your problem, right?

Jeff Squyres
Cisco Systems