In your message you describe a very awkward task to be performed by the user.
If MPI_GET_CHAR_DATATYPE and MPI_PUT_CHAR_DATATYPE are just for
sending type representations back and forth, then why make the user
go through hoops and hurdles?
However, an MPI_CREATE_CHAR_DATATYPE could easily perform this --
as Jim describes:
> 1) Receive the flattened (printable ?) type description.
> 2) Throw away all of the layout information.
> 3) Use the type information to construct a suitable datatype
> (and allocate space for it, I assume),
Step 3 is performed by
A. compute the total of bytes
i. for each type requested
a. compute the local size
b. multiply by the count requested
ii. add them up.
B. allocate (malloc) space
C. compute the offsets (actually, this can be done in A.ii)
D. call MPI_Datatype and MPI_type_commit
This function would return a pointer to the object (contiguous memory
area). It's internal components can only be manipulated by MPI,
but this is as desired.
The last step Jim describes is done at the user's discretion:
> 4) Receive the data using your new, locally constructed datatype.
> All done, no problem. You now have the data layed out as you want in
> your local store, and know the types of it.