Rework of C Interface exception handler.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-07-26 16:30:00 +02:00
parent a4bb8864a0
commit 418d811d18
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
#include "Core.hpp" #include "Core.hpp"
std::string ExceptionHandler::_lastException = ""; char* ExceptionHandler::_lastException = 0;
export const char* CreatureLib_C_GetLastException() { return ExceptionHandler::GetLastException(); } export const char* CreatureLib_C_GetLastException() { return ExceptionHandler::GetLastException(); }

View File

@ -9,11 +9,11 @@
#define CreatureLibException 1; #define CreatureLibException 1;
class ExceptionHandler { class ExceptionHandler {
static std::string _lastException; static char* _lastException;
public: public:
static void SetLastException(const std::exception& e) { _lastException = std::string(e.what()); } static void SetLastException(const std::exception& e) { _lastException = strcpy(_lastException, e.what()); }
static const char* GetLastException() { return _lastException.c_str(); } static const char* GetLastException() { return _lastException; }
}; };
#define Try(data) \ #define Try(data) \