diff --git a/include/sigfn.h b/include/sigfn.h index 3b9b477..adefcfa 100644 --- a/include/sigfn.h +++ b/include/sigfn.h @@ -35,6 +35,12 @@ #include #include +#ifdef _WIN32 +#define DLL_EXPORT __declspec(dllexport) +#else +#define DLL_EXPORT +#endif + #ifdef __cplusplus extern "C" { @@ -55,21 +61,21 @@ extern "C" * @param handler function associated with this signal * @param userdata optional user data passed to the function */ - int sigfn_handle(int signum, sigfn_handler_func handler, void *userdata); + DLL_EXPORT int sigfn_handle(int signum, sigfn_handler_func handler, void *userdata); /** * @brief ignore a specific signal * * @param signum signal to ignore */ - int sigfn_ignore(int signum); + DLL_EXPORT int sigfn_ignore(int signum); /** * @brief reset a specific signal to its default behavior * * @param signum signal to reset */ - int sigfn_reset(int signum); + DLL_EXPORT int sigfn_reset(int signum); #ifdef __cplusplus } diff --git a/include/sigfn.hpp b/include/sigfn.hpp index 652dad7..21262aa 100644 --- a/include/sigfn.hpp +++ b/include/sigfn.hpp @@ -46,7 +46,7 @@ namespace sigfn * * @class exception allows sigfn error codes to be thrown as exceptions */ - class exception final : public std::exception + class DLL_EXPORT exception final : public std::exception { private: std::string _error_message; @@ -62,7 +62,7 @@ namespace sigfn * @param signum signal to be handled * @param handler_function function object associated with this signal */ - void handle(int signum, const handler_function &handler_function); + DLL_EXPORT void handle(int signum, const handler_function &handler_function); /** * @brief attach handler to specific signal using move semantics @@ -70,21 +70,21 @@ namespace sigfn * @param signum signal to be handled * @param handler_function function object associated with this signal */ - void handle(int signum, handler_function &&handler_function); + DLL_EXPORT void handle(int signum, handler_function &&handler_function); /** * @brief ignore a specific signal * * @param signum signal to be ignored */ - void ignore(int signum); + DLL_EXPORT void ignore(int signum); /** * @brief reset a specific signal to its default behavior * * @param signum signal to be reset */ - void reset(int signum); + DLL_EXPORT void reset(int signum); } #endif \ No newline at end of file