Exécution d'une mappe unique

Cet exemple illustre la façon la plus simple de charger et d'exécuter une mappe. Une fois la mappe chargée, elle peut être exécutée autant de fois que nécessaire.

#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;
}