Skip to content

Commit

Permalink
added DLL export for windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpatek committed Mar 19, 2024
1 parent 2abe272 commit c6b5fa7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 9 additions & 3 deletions include/sigfn.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
#include <stdlib.h>
#include <signal.h>

#ifdef _WIN32
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT
#endif

#ifdef __cplusplus
extern "C"
{
Expand All @@ -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
}
Expand Down
10 changes: 5 additions & 5 deletions include/sigfn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -62,29 +62,29 @@ 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
*
* @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

0 comments on commit c6b5fa7

Please sign in to comment.