1
2
3
4
5
6 #ifndef CMAJOR_RT_ERROR_INCLUDED
7 #define CMAJOR_RT_ERROR_INCLUDED
8 #include <cmajor/rt/RtApi.hpp>
9 #include <cmajor/eh/Exception.hpp>
10 #include <string>
11 #include <stdint.h>
12
13 const int exitCodeAccessViolation = 255;
14 const int exitCodeInternalError = 254;
15 const int exitCodeAssertionFailed = 253;
16 const int exitCodeOutOfMemory = 252;
17 const int exitCodeExceptionEscapedFromThread = 251;
18 const int exitCodeSocketInitializationFailed = 250;
19
20 using AssertionFailureFunction = void (*);
21
22 extern "C" bool RtIsUserAssertionFailureFunctionSet();
23 extern "C" void RtSetUserAssertionFailureFunction(AssertionFailureFunction userAssertionFailureFunc);
24 extern "C" void RtFailAssertion(const char* assertion, const char* function, const char* sourceFilePath, int lineNumber);
25 extern "C" const char* RtGetError(int32_t errorId);
26 extern "C" void RtDisposeError(int32_t errorId);
27 extern "C" void RtThrowException(void* exception, void* exceptionTypeId);
28 extern "C" void RtCaptureException(void** exception, uint64_t & exceptionClassIdHi, uint64_t & exceptionClassIdLo);
29 extern "C" void RtThrowCapturedException(void* exception, uint64_t exceptionClassIdHi, uint64_t exceptionClassIdLo);
30 extern "C" bool RtHandleException(void* exceptionTypeId);
31 extern "C" void* RtGetException();
32 extern "C" void* RtGetExceptionTypeId();
33
34 namespace cmajor { namespace rt {
35
36 int32_t InstallError(const std::string& errorMessage);
37 const char* GetError(int32_t errorId);
38 void DisposeError(int32_t errorId);
39 void InitError();
40 void DoneError();
41
42 } }
43
44 #endif // CMAJOR_RT_ERROR_INCLUDED