qzdoom-gpl/src/sound/except.h
Christoph Oelckers d880783784 - make OpenAL and the decoder libraries delay loaded so that ZDoom can still start without them being present.
This required the addition of a few exception handlers so to avoid #ifdef overuse I also added some #defines for non-Windows systems that allow using __try and __except directly in the code without #ifdef'ing them out.
2015-04-25 12:25:10 +02:00

34 lines
No EOL
740 B
C

#ifndef __EXCEPT_H
#define __EXCEPT_H
#ifdef _MSC_VER
//==========================================================================
//
// CheckException
//
//==========================================================================
#ifndef FACILITY_VISUALCPP
#define FACILITY_VISUALCPP ((LONG)0x6d)
#endif
#define VcppException(sev,err) ((sev) | (FACILITY_VISUALCPP<<16) | err)
inline int CheckException(DWORD code)
{
if (code == VcppException(ERROR_SEVERITY_ERROR,ERROR_MOD_NOT_FOUND) ||
code == VcppException(ERROR_SEVERITY_ERROR,ERROR_PROC_NOT_FOUND))
{
return EXCEPTION_EXECUTE_HANDLER;
}
return EXCEPTION_CONTINUE_SEARCH;
}
#else
#define __try
#define __except(a) if (0)
#endif
#endif