Running a single map

This example shows the simplest way to load and run a map. After the map is loaded, it can be run any number of times.

#include "dtxpi.h"
#define CHECK_ERR(rc) if(MPIRC_FAILED(rc)) 
 { printf("Last error is: %s\n",mpiErrorGetText(rc)); return -1;}

int main()
{
const char     *szMsg;
int            iRC;
MPIRC          rc;
HMPIMAP        hMap;

rc = mpiInitAPI(NULL); 
CHECK_ERR(rc);

rc = mpiMapLoadFile (&hMap, "test1.mmc");
CHECK_ERR(rc);

rc = mpiMapRun (hMap);
CHECK_ERR(rc);

rc = mpiPropertyGetText (hMap, MPIP_OBJECT_ERROR_MSG, 0, &szMsg, NULL);
CHECK_ERR(rc);

rc = mpiPropertyGetInteger (hMap, MPIP_OBJECT_ERROR_CODE, 0, &iRC);
CHECK_ERR(rc);
printf("Map status: %s (%d)\n", szMsg, iRC);

rc = mpiMapUnload (hMap);
CHECK_ERR(rc);

rc = mpiTermAPI();
CHECK_ERR(rc);
return 0;
}