next up previous contents
Next: Array count arguments. Up: Language Binding Previous: Error codes.   Contents

Multiple return values.

A few functions in the MPI interface return multiple values, even after the error code is eliminated. This is dealt with in mpiJava in various ways. Sometimes an MPI function initializes some elements in an array and also returns a count of the number of elements modified. In Java we typically return an array result, omitting the count. The count can be obtained subsequently from the length member of the array. Sometimes an MPI function initializes an object conditionally and returns a separate flag to say if the operation succeeded. In Java we typically return an object reference which is null if the operation fails. Occasionally extra internal state is added to an existing MPI class to hold extra results--for example the Status class has extra state initialized by functions like Waitany to hold the index value. Rarely none of these methods work and we resort to defining auxilliary classes to hold multiple results from a particular function.

Bryan Carpenter 2002-07-12