#include "mathlink.h"/* calculate the sum of the integers in a list and check for a message on a link */int f(MLINK lp, int *list, int len){ int sum; while(len--) { sum += *list++; if(MLMessageReady(lp)) { /* read the message */ } } return sum;}