Rename C interface for getting last exception
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-04-14 15:43:30 +02:00
parent e35f860b84
commit cb942c4e89
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 4 additions and 2 deletions

View File

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

View File

@ -6,6 +6,8 @@
#include <string> #include <string>
#define export extern "C" #define export extern "C"
#define CreatureLibException 1;
class ExceptionHandler { class ExceptionHandler {
static std::string _lastException; static std::string _lastException;
@ -20,7 +22,7 @@ public:
return 0; \ return 0; \
} catch (const std::exception& e) { \ } catch (const std::exception& e) { \
ExceptionHandler::SetLastException(e); \ ExceptionHandler::SetLastException(e); \
return 1; \ return CreatureLibException; \
} }
#endif // CREATURELIB_CORE_HPP #endif // CREATURELIB_CORE_HPP