diff --git a/Athena/src/core.h b/Athena/src/core.h index 3cba099..7c2c7ac 100644 --- a/Athena/src/core.h +++ b/Athena/src/core.h @@ -2,11 +2,17 @@ #ifndef CORE #define CORE #ifdef AT_CPP_API - #ifdef AT_BUILD_DLL - #define AT_API __declspec(dllexport) + #if defined(_WIN32) || defined(_WIN64) + #ifdef AT_BUILD_DLL + #define AT_API __declspec(dllexport) + #else + #define AT_API __declspec(dllimport) + #endif // AT_BUILD_DLL #else - #define AT_API __declspec(dllimport) - #endif // AT_BUILD_DLL + #ifdef AT_BUILD_DLL + #define AT_API __attribute__((visibility("default"))) + #endif + #endif #else #define AT_API #endif // AT_CPP_API diff --git a/Athena/src/exceptions/badStreamException.h b/Athena/src/exceptions/badStreamException.h index 5da23be..10f11db 100644 --- a/Athena/src/exceptions/badStreamException.h +++ b/Athena/src/exceptions/badStreamException.h @@ -2,16 +2,16 @@ #ifndef BAD_STREAM_EXCEPTION #define BAD_STREAM_EXCEPTION -#include +#include #include namespace athena { namespace exceptions { - class badStreamException : public std::exception + class badStreamException : public std::runtime_error { public: - badStreamException(const char* error) : std::exception("[athena] a badStream error occured") + badStreamException(const char* error) : std::runtime_error("[athena] a badStream error occured") { std::cerr << "[Athena] badStream error: " << error << std::endl; }; diff --git a/Athena/src/exceptions/compressionException.h b/Athena/src/exceptions/compressionException.h index 3134048..e48febd 100644 --- a/Athena/src/exceptions/compressionException.h +++ b/Athena/src/exceptions/compressionException.h @@ -3,17 +3,17 @@ #define COMPRESSION_ERROR #include -#include +#include #include namespace athena { namespace exceptions { - class compressionException : public std::exception + class compressionException : public std::runtime_error { public: - compressionException(const char* error) : std::exception("[athena] a compression error occured") + compressionException(const char* error) : std::runtime_error("[athena] a compression error occured") { std::cerr << "[Athena] compression error: " << error << std::endl; }; diff --git a/Athena/src/exceptions/indexBoundsException.h b/Athena/src/exceptions/indexBoundsException.h index 249f4ec..309dba3 100644 --- a/Athena/src/exceptions/indexBoundsException.h +++ b/Athena/src/exceptions/indexBoundsException.h @@ -4,17 +4,17 @@ #include -#include +#include #include namespace athena { namespace exceptions { - class AT_API indexOutOfBoundsException : public std::exception + class AT_API indexOutOfBoundsException : public std::runtime_error { public: - indexOutOfBoundsException(const char* msg) : std::exception("[athena] index was out of bounds!") + indexOutOfBoundsException(const char* msg) : std::runtime_error("[athena] index was out of bounds!") { std::cerr << "[Athena] indexOutOfBoundsException: " << msg << std::endl; } diff --git a/Athena/src/util/buffer.h b/Athena/src/util/buffer.h index d8db9af..a84dd09 100644 --- a/Athena/src/util/buffer.h +++ b/Athena/src/util/buffer.h @@ -3,6 +3,14 @@ #define BUFFER #include #include +#include +#include +#include + +#ifdef __linux__ +#include +#include +#endif namespace athena { @@ -40,7 +48,7 @@ namespace athena static constexpr bool value = type::value; }; - class buffer + class buffer { public: #pragma region write @@ -117,10 +125,10 @@ namespace athena else memcpy_s(reinterpret_cast(p_struct), structSize, p_src, structSize); - + delete[] p_src; return *p_struct; - + } template diff --git a/README.md b/README.md index f511016..2b48f14 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,9 @@ Athena is ideal for developers who need a high-performance, flexible solution fo ``` to build run BUILD.bat or BUILD.sh. this just runs the python build.py script for convenience. + +on Linux, ensure libsafec is installed: +sudo apt install libsafec-dev ``` [more info](build.md) ## 2) example: diff --git a/premake5.lua b/premake5.lua index f0dd7a0..5864df6 100644 --- a/premake5.lua +++ b/premake5.lua @@ -128,6 +128,14 @@ project "Athena" optimize "On" filter "system:linux" + links + { + "safec" + } + includedirs + { + "/usr/include/safeclib" + } filter "configurations:debug" symbols "On" filter "configurations:release" @@ -179,6 +187,14 @@ project "sandbox" optimize "On" filter "system:linux" + links + { + "safec" + } + includedirs + { + "/usr/include/safeclib" + } filter "configurations:debug" symbols "On" filter "configurations:release" @@ -190,4 +206,4 @@ project "sandbox" if _OPTIONS["enable-WSL"] then toolchainversion "wsl2" end -end \ No newline at end of file +end