Re: [MPI3 Fortran] Start discussing new Fortran binding
On Feb 19, 2008, at 8:38 AM, Lionel, Steve wrote:
2. Is there a way to use a preprocessor to replace something like this
integer(MPI_HANDLE_TYPE), value, intent(in) :: datatype
with either C_INT or C_PTR, depending on what the implementation requires?
The proper (IMO) way to do this in Fortran is as follows:
type, BIND(C) :: MPI_HANDLE_TYPE private type(C_PTR) :: handle end type MPI_HANDLE_TYPE
This allows the user to declare things of type(MPI_HANDLE_TYPE) but makes the contents inaccessible other than passing, storing or fetching. The BIND(C) tells the Fortran compiler that this is an interoperable type and it is not allowed to pad it or rearrange the contents.
Jeff and I tried to make this work out in our paper but thought there might be problems interfacing with exiting MPI implementations. However, I agree this would be a better approach if it can be made to work with MPI implementations that work with both integers and pointers to structs. I'll think some more about how to use your approach, perhaps you could add you brain power to it as well. I think this should be the main topic for conversation in our telecon this week. Agree? Cheers, Craig
participants (1)
-
Craig Rasmussen