diff --git a/include/libipc/buffer.h b/include/libipc/buffer.h index 456019a..e940c04 100755 --- a/include/libipc/buffer.h +++ b/include/libipc/buffer.h @@ -10,7 +10,7 @@ namespace ipc { -class IPC_EXPORT buffer { +class LIBIPC_EXPORT buffer { public: using destructor_t = void (*)(void*, std::size_t); @@ -59,8 +59,8 @@ public: }; } - friend IPC_EXPORT bool operator==(buffer const & b1, buffer const & b2); - friend IPC_EXPORT bool operator!=(buffer const & b1, buffer const & b2); + friend LIBIPC_EXPORT bool operator==(buffer const & b1, buffer const & b2); + friend LIBIPC_EXPORT bool operator!=(buffer const & b1, buffer const & b2); private: class buffer_; diff --git a/include/libipc/condition.h b/include/libipc/condition.h index 6c15746..201c33f 100644 --- a/include/libipc/condition.h +++ b/include/libipc/condition.h @@ -9,7 +9,7 @@ namespace ipc { namespace sync { -class IPC_EXPORT condition { +class LIBIPC_EXPORT condition { condition(condition const &) = delete; condition &operator=(condition const &) = delete; diff --git a/include/libipc/imp/codecvt.h b/include/libipc/imp/codecvt.h index 1526f1e..dda2b9f 100644 --- a/include/libipc/imp/codecvt.h +++ b/include/libipc/imp/codecvt.h @@ -19,7 +19,7 @@ namespace ipc { * \param dlen The target string length can be 0 */ template -IPC_EXPORT std::size_t cvt_cstr(CharT const *src, std::size_t slen, CharU *des, std::size_t dlen) noexcept; +LIBIPC_EXPORT std::size_t cvt_cstr(CharT const *src, std::size_t slen, CharU *des, std::size_t dlen) noexcept; template diff --git a/include/libipc/imp/export.h b/include/libipc/imp/export.h index 98e1b91..027fd00 100755 --- a/include/libipc/imp/export.h +++ b/include/libipc/imp/export.h @@ -9,37 +9,37 @@ #if defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) -# define IPC_DECL_EXPORT Q_DECL_EXPORT -# define IPC_DECL_IMPORT Q_DECL_IMPORT +# define LIBIPC_DECL_EXPORT Q_DECL_EXPORT +# define LIBIPC_DECL_IMPORT Q_DECL_IMPORT #else // defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) /** - * \brief Compiler & system detection for IPC_DECL_EXPORT & IPC_DECL_IMPORT. + * \brief Compiler & system detection for LIBIPC_DECL_EXPORT & LIBIPC_DECL_IMPORT. * Not using QtCore cause it shouldn't depend on Qt. */ # if defined(LIBIPC_CC_MSVC) || defined(LIBIPC_OS_WIN) -# define IPC_DECL_EXPORT __declspec(dllexport) -# define IPC_DECL_IMPORT __declspec(dllimport) +# define LIBIPC_DECL_EXPORT __declspec(dllexport) +# define LIBIPC_DECL_IMPORT __declspec(dllimport) # elif defined(LIBIPC_OS_ANDROID) || defined(LIBIPC_OS_LINUX) || defined(LIBIPC_CC_GNUC) -# define IPC_DECL_EXPORT __attribute__((visibility("default"))) -# define IPC_DECL_IMPORT __attribute__((visibility("default"))) +# define LIBIPC_DECL_EXPORT __attribute__((visibility("default"))) +# define LIBIPC_DECL_IMPORT __attribute__((visibility("default"))) # else -# define IPC_DECL_EXPORT __attribute__((visibility("default"))) -# define IPC_DECL_IMPORT __attribute__((visibility("default"))) +# define LIBIPC_DECL_EXPORT __attribute__((visibility("default"))) +# define LIBIPC_DECL_IMPORT __attribute__((visibility("default"))) # endif #endif // defined(Q_DECL_EXPORT) && defined(Q_DECL_IMPORT) /** - * \brief Define IPC_EXPORT for exporting function & class. + * \brief Define LIBIPC_EXPORT for exporting function & class. */ -#ifndef IPC_EXPORT +#ifndef LIBIPC_EXPORT # if defined(LIBIPC_LIBRARY_SHARED_BUILDING__) -# define IPC_EXPORT IPC_DECL_EXPORT +# define LIBIPC_EXPORT LIBIPC_DECL_EXPORT # elif defined(LIBIPC_LIBRARY_SHARED_USING__) -# define IPC_EXPORT IPC_DECL_IMPORT +# define LIBIPC_EXPORT LIBIPC_DECL_IMPORT # else -# define IPC_EXPORT +# define LIBIPC_EXPORT # endif -#endif /*IPC_EXPORT*/ +#endif /*LIBIPC_EXPORT*/ diff --git a/include/libipc/imp/fmt.h b/include/libipc/imp/fmt.h index af0a5c4..5ccaf48 100644 --- a/include/libipc/imp/fmt.h +++ b/include/libipc/imp/fmt.h @@ -65,45 +65,45 @@ LIBIPC_NODISCARD std::string fmt(A &&...args) { } /// \brief String types. -IPC_EXPORT bool to_string(fmt_context &ctx, char const * a) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, std::string const &a) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, char const * a, span fstr) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, char const * a) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, std::string const &a) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, char const * a, span fstr) noexcept; inline bool to_string(fmt_context &ctx, std::string const &a, span fstr) noexcept { return to_string(ctx, a.c_str(), fstr); } /// \brief Character to string conversion. -IPC_EXPORT bool to_string(fmt_context &ctx, char a) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, char a) noexcept; #if defined(LIBIPC_CPP_20) inline bool to_string(fmt_context &ctx, char8_t a) noexcept { return to_string(ctx, (char)a); } #endif // defined(LIBIPC_CPP_20) -IPC_EXPORT bool to_string(fmt_context &ctx, wchar_t a) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, char16_t a) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, char32_t a) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, wchar_t a) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, char16_t a) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, char32_t a) noexcept; /// \brief Conversion of numeric types to strings. -IPC_EXPORT bool to_string(fmt_context &ctx, signed short a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, unsigned short a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, signed int a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, unsigned int a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, signed long a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, unsigned long a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, signed long long a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, unsigned long long a, span fstr = {}) noexcept; - inline bool to_string(fmt_context &ctx, signed char a, span fstr = {}) noexcept { return to_string(ctx, (int)a, fstr); } - inline bool to_string(fmt_context &ctx, unsigned char a, span fstr = {}) noexcept { return to_string(ctx, (unsigned)a, fstr); } +LIBIPC_EXPORT bool to_string(fmt_context &ctx, signed short a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, unsigned short a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, signed int a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, unsigned int a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, signed long a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, unsigned long a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, signed long long a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, unsigned long long a, span fstr = {}) noexcept; + inline bool to_string(fmt_context &ctx, signed char a, span fstr = {}) noexcept { return to_string(ctx, (int)a, fstr); } + inline bool to_string(fmt_context &ctx, unsigned char a, span fstr = {}) noexcept { return to_string(ctx, (unsigned)a, fstr); } /// \brief Conversion of floating point type to strings. -IPC_EXPORT bool to_string(fmt_context &ctx, double a, span fstr = {}) noexcept; -IPC_EXPORT bool to_string(fmt_context &ctx, long double a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, double a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, long double a, span fstr = {}) noexcept; inline bool to_string(fmt_context &ctx, float a, span fstr = {}) noexcept { return to_string(ctx, (double)a, fstr); } /// \brief Pointer. -IPC_EXPORT bool to_string(fmt_context &ctx, std::nullptr_t) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, std::nullptr_t) noexcept; template ::value>> -IPC_EXPORT bool to_string(fmt_context &ctx, T const volatile *a) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, T const volatile *a) noexcept; /// \brief Date and time. -IPC_EXPORT bool to_string(fmt_context &ctx, std::tm const &a, span fstr = {}) noexcept; +LIBIPC_EXPORT bool to_string(fmt_context &ctx, std::tm const &a, span fstr = {}) noexcept; namespace detail_fmt { diff --git a/include/libipc/imp/fmt_cpo.h b/include/libipc/imp/fmt_cpo.h index e7be313..463ef8b 100644 --- a/include/libipc/imp/fmt_cpo.h +++ b/include/libipc/imp/fmt_cpo.h @@ -17,10 +17,10 @@ namespace ipc { /** - * \class class IPC_EXPORT fmt_context + * \class class LIBIPC_EXPORT fmt_context * \brief The context of fmt. */ -class IPC_EXPORT fmt_context { +class LIBIPC_EXPORT fmt_context { std::array sbuf_; ///< stack buffer std::string &joined_; diff --git a/include/libipc/imp/nameof.h b/include/libipc/imp/nameof.h index 704fc0c..ec7b4b2 100644 --- a/include/libipc/imp/nameof.h +++ b/include/libipc/imp/nameof.h @@ -22,7 +22,7 @@ namespace ipc { * \param name the mangled name * \return std::string a human-readable demangled type name */ -IPC_EXPORT std::string demangle(std::string name) noexcept; +LIBIPC_EXPORT std::string demangle(std::string name) noexcept; /** * \brief Returns an implementation defined string containing the name of the type. diff --git a/include/libipc/ipc.h b/include/libipc/ipc.h index 05877be..c7827ee 100755 --- a/include/libipc/ipc.h +++ b/include/libipc/ipc.h @@ -18,7 +18,7 @@ enum : unsigned { }; template -struct IPC_EXPORT chan_impl { +struct LIBIPC_EXPORT chan_impl { static ipc::handle_t init_first(); static bool connect (ipc::handle_t * ph, char const * name, unsigned mode); diff --git a/include/libipc/mem/new.h b/include/libipc/mem/new.h index 6b4cfe4..ce62140 100644 --- a/include/libipc/mem/new.h +++ b/include/libipc/mem/new.h @@ -14,7 +14,7 @@ #include "libipc/imp/byte.h" #include "libipc/imp/detect_plat.h" -#include "libipc/export.h" +#include "libipc/imp/export.h" namespace ipc { namespace mem { diff --git a/include/libipc/mutex.h b/include/libipc/mutex.h index 9bbb2fd..422e496 100644 --- a/include/libipc/mutex.h +++ b/include/libipc/mutex.h @@ -9,7 +9,7 @@ namespace ipc { namespace sync { -class IPC_EXPORT mutex { +class LIBIPC_EXPORT mutex { mutex(mutex const &) = delete; mutex &operator=(mutex const &) = delete; diff --git a/include/libipc/pool_alloc.h b/include/libipc/pool_alloc.h index 9c94bff..7ae299c 100755 --- a/include/libipc/pool_alloc.h +++ b/include/libipc/pool_alloc.h @@ -9,7 +9,7 @@ namespace ipc { namespace mem { -class IPC_EXPORT pool_alloc { +class LIBIPC_EXPORT pool_alloc { public: static void* alloc(std::size_t size) noexcept; static void free (void* p, std::size_t size) noexcept; diff --git a/include/libipc/semaphore.h b/include/libipc/semaphore.h index 72d5679..8be73e8 100644 --- a/include/libipc/semaphore.h +++ b/include/libipc/semaphore.h @@ -8,7 +8,7 @@ namespace ipc { namespace sync { -class IPC_EXPORT semaphore { +class LIBIPC_EXPORT semaphore { semaphore(semaphore const &) = delete; semaphore &operator=(semaphore const &) = delete; diff --git a/include/libipc/shm.h b/include/libipc/shm.h index a11695c..ea28bda 100755 --- a/include/libipc/shm.h +++ b/include/libipc/shm.h @@ -15,8 +15,8 @@ enum : unsigned { open = 0x02 }; -IPC_EXPORT id_t acquire(char const * name, std::size_t size, unsigned mode = create | open); -IPC_EXPORT void * get_mem(id_t id, std::size_t * size); +LIBIPC_EXPORT id_t acquire(char const * name, std::size_t size, unsigned mode = create | open); +LIBIPC_EXPORT void * get_mem(id_t id, std::size_t * size); // Release shared memory resource and clean up disk file if reference count reaches zero. // This function decrements the reference counter. When the counter reaches zero, it: @@ -25,7 +25,7 @@ IPC_EXPORT void * get_mem(id_t id, std::size_t * size); // 3. Frees the id structure // After calling this function, the id becomes invalid and must not be used again. // Returns: The reference count before decrement, or -1 on error. -IPC_EXPORT std::int32_t release(id_t id) noexcept; +LIBIPC_EXPORT std::int32_t release(id_t id) noexcept; // Release shared memory resource and force cleanup of disk file. // This function calls release(id) internally, then unconditionally attempts to @@ -34,19 +34,19 @@ IPC_EXPORT std::int32_t release(id_t id) noexcept; // not in combination with release(). // Typical use case: Force cleanup when you want to ensure the disk file is removed // regardless of reference count state. -IPC_EXPORT void remove (id_t id) noexcept; +LIBIPC_EXPORT void remove (id_t id) noexcept; // Remove shared memory backing file by name. // This function only removes the disk file and does not affect any active memory // mappings or id structures. Use this for cleanup of orphaned files or for explicit // file removal without affecting runtime resources. // Safe to call at any time, even if shared memory is still in use elsewhere. -IPC_EXPORT void remove (char const * name) noexcept; +LIBIPC_EXPORT void remove (char const * name) noexcept; -IPC_EXPORT std::int32_t get_ref(id_t id); -IPC_EXPORT void sub_ref(id_t id); +LIBIPC_EXPORT std::int32_t get_ref(id_t id); +LIBIPC_EXPORT void sub_ref(id_t id); -class IPC_EXPORT handle { +class LIBIPC_EXPORT handle { public: handle(); handle(char const * name, std::size_t size, unsigned mode = create | open); @@ -83,3 +83,4 @@ private: } // namespace shm } // namespace ipc +