On Wed, 2008-01-30 at 21:21 -0500, Jeff Squyres wrote:
> 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 understand.

> > I'm recommending a change to mpi.h which would let C headers  
> > included by
> > C++ programs do:
> > #define OMPI_SKIP_MPICXX
> > #include <mpi.h>
> > #undef OMPI_SKIP_MPICXX
> > 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?

Sort of, though it will require a large patch to Salomé to get around
this, vs. a small patch to OpenMPI to provide a simple workaround to
this class a problems.  Basically, I'll need to patch every .hh file to
make sure it #includes mpi.h or hdf5.h before #including any .h file
with an mpi.h or hdf5.h #include in it.

Given that Salomé does this, it must have worked with another MPI
implementation.  And that means that there is likely other software
which will try this.

As I understand it, your only objection to the change now is "programs
shouldn't be doing this", not "this will break something".

But then, why wouldn't programs expect to be able to include C headers
in a C++ extern C block?  Or rather, why shouldn't they be able to do so
with mpi.h -- or hdf5.h, which isn't mpi.h -- when numerous other C
header files allow it, possibly including other MPI implementations?
After all, it's called mpi.h not mpi.hh or .hxx or mpi_cxx.h, right?
And isn't the patched version cleaner, in that it separates the C and
C++ prototypes into different #ifdef/#define regions?

Thanks for the reply, sorry about the delay in getting back to you.

-Adam
-- 
GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6

Engineering consulting with open source tools
http://www.opennovation.com/

Reply via email to