c tricks compilation - Serbipunk/notes GitHub Wiki

SAFE_RUNNING


#define SAFE_RUNNING(acutal_function)									\
  __try {return acutal_function;											} \
  __except(CrashDumpHandler(GetExceptionInformation()))					\
  {wprintf(L"Program has crashed. Refer to the dump file for more details:\n%s\n", GetDumpFilePathName()); return -3;}

#define SAFE_RUNNING_PTR(acutal_function)								\
  __try {return acutal_function;											} \
  __except(CrashDumpHandler(GetExceptionInformation()))					\
  {wprintf(L"Program has crashed. Refer to the dump file for more details:\n%s\n", GetDumpFilePathName()); return NULL;}

#else
#define SAFE_RUNNING(acutal_function) return acutal_function;
#define SAFE_RUNNING_PTR(acutal_function) return acutal_function;
#endif