On the receiving side, the user calls AP_recv() giving criteria for the message it wishes to receive. Flags may be specified to select various options such as blocking. Memory is automatically allocated to receive messages from MPI. If a message is available that matches the user's criteria, a pointer into the library's storage area is returned. When the user is done examining the contents of the message, a call to the library notifies it that the space may be reclaimed (Figure 3).
In Fortran, the AP_RECV() routine is unable to pass back a pointer to the received message. Instead, it returns an integer descriptor. Once the user code has examined the tag and size, and decided which Fortran variable to store the message in, this descriptor is given to AP_COPY_FREE() to copy the message there and free the library's buffer (Figure 4).