You'll still need to create a datatype for MPI_Pack. This is the
structure you mentioned:
I'm assuming you want to send the size and the data associated with lptr
struct A
{
int size;
int *lptr;
};
in a single message. In this case, the only approaches I can think of are:
1. Create a datatype every time you want to send this information and
free it once you are done.
2. Send two messages, one with the size parameter and the second with
the data pointed to by lptr.
Someone else might have a better way to do this.