From: =?utf-8?q?Timo_R=C3=B6hling?= <timo@gaussglocke.de>
Date: Tue, 24 Nov 2020 10:38:48 +0100
Subject: Fix visibility of exception classes

Forwarded: https://github.com/eProsima/Fast-CDR/pull/88

C++ exceptions which are potentially thrown across DSO boundaries need
to have their type info exported.
---
 include/fastcdr/exceptions/BadParamException.h        | 16 ++++++++--------
 include/fastcdr/exceptions/Exception.h                | 18 +++++++++---------
 include/fastcdr/exceptions/NotEnoughMemoryException.h | 18 +++++++++---------
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/include/fastcdr/exceptions/BadParamException.h b/include/fastcdr/exceptions/BadParamException.h
index 95838ed..9c56748 100644
--- a/include/fastcdr/exceptions/BadParamException.h
+++ b/include/fastcdr/exceptions/BadParamException.h
@@ -24,7 +24,7 @@ namespace exception {
  * @brief This class is thrown as an exception when a invalid parameter was being serialized.
  * @ingroup EXCEPTIONMODULE
  */
-class BadParamException : public Exception
+class Cdr_DllAPI BadParamException : public Exception
 {
 public:
 
@@ -33,7 +33,7 @@ public:
      *
      * @param message A error message. This message pointer is copied.
      */
-    Cdr_DllAPI BadParamException(
+    BadParamException(
             const char* const& message) noexcept;
 
     /*!
@@ -41,7 +41,7 @@ public:
      *
      * @param ex BadParamException that will be copied.
      */
-    Cdr_DllAPI BadParamException(
+    BadParamException(
             const BadParamException& ex) noexcept;
 
 #if HAVE_CXX0X
@@ -50,7 +50,7 @@ public:
      *
      * @param ex BadParamException that will be moved.
      */
-    Cdr_DllAPI BadParamException(
+    BadParamException(
             BadParamException&& ex) noexcept;
 #endif // if HAVE_CXX0X
 
@@ -59,7 +59,7 @@ public:
      *
      * @param ex BadParamException that will be copied.
      */
-    Cdr_DllAPI BadParamException& operator =(
+    BadParamException& operator =(
             const BadParamException& ex) noexcept;
 
 #if HAVE_CXX0X
@@ -73,13 +73,13 @@ public:
 #endif // if HAVE_CXX0X
 
     //! @brief Default constructor
-    virtual Cdr_DllAPI ~BadParamException() noexcept;
+    virtual ~BadParamException() noexcept;
 
     //! @brief This function throws the object as exception.
-    virtual Cdr_DllAPI void raise() const;
+    virtual void raise() const;
 
     //! @brief Default message used in the library.
-    static Cdr_DllAPI const char* const BAD_PARAM_MESSAGE_DEFAULT;
+    static const char* const BAD_PARAM_MESSAGE_DEFAULT;
 };
 }         //namespace exception
 }     //namespace fastcdr
diff --git a/include/fastcdr/exceptions/Exception.h b/include/fastcdr/exceptions/Exception.h
index b371332..d9de9e6 100644
--- a/include/fastcdr/exceptions/Exception.h
+++ b/include/fastcdr/exceptions/Exception.h
@@ -26,22 +26,22 @@ namespace exception {
  * @brief This abstract class is used to create exceptions.
  * @ingroup EXCEPTIONMODULE
  */
-class Exception : public std::exception
+class Cdr_DllAPI Exception : public std::exception
 {
 public:
 
     //! \brief Default destructor.
-    virtual Cdr_DllAPI ~Exception() noexcept;
+    virtual ~Exception() noexcept;
 
     //! \brief This function throws the object as exception.
-    virtual Cdr_DllAPI void raise() const = 0;
+    virtual void raise() const = 0;
 
     /*!
      * @brief This function returns the error message.
      *
      * @return The error message.
      */
-    virtual Cdr_DllAPI const char* what() const noexcept override;
+    virtual const char* what() const noexcept override;
 
 protected:
 
@@ -50,7 +50,7 @@ protected:
      *
      * @param message A error message. This message pointer is copied.
      */
-    Cdr_DllAPI Exception(
+    Exception(
             const char* const& message) noexcept;
 
     /*!
@@ -58,7 +58,7 @@ protected:
      *
      * @param ex Exception that will be copied.
      */
-    Cdr_DllAPI Exception(
+    Exception(
             const Exception& ex) noexcept;
 
 #if HAVE_CXX0X
@@ -67,7 +67,7 @@ protected:
      *
      * @param ex Exception that will be moved.
      */
-    Cdr_DllAPI Exception(
+    Exception(
             Exception&& ex) noexcept;
 #endif // if HAVE_CXX0X
 
@@ -76,7 +76,7 @@ protected:
      *
      * @param ex Exception that will be copied.
      */
-    Cdr_DllAPI Exception& operator =(
+    Exception& operator =(
             const Exception& ex) noexcept;
 
 #if HAVE_CXX0X
@@ -85,7 +85,7 @@ protected:
      *
      * @param ex Exception that will be moved.
      */
-    Cdr_DllAPI Exception& operator =(
+    Exception& operator =(
             Exception&&) noexcept;
 #endif // if HAVE_CXX0X
 
diff --git a/include/fastcdr/exceptions/NotEnoughMemoryException.h b/include/fastcdr/exceptions/NotEnoughMemoryException.h
index 3a190c5..06377d2 100644
--- a/include/fastcdr/exceptions/NotEnoughMemoryException.h
+++ b/include/fastcdr/exceptions/NotEnoughMemoryException.h
@@ -24,7 +24,7 @@ namespace exception {
  * @brief This class is thrown as an exception when the buffer's internal memory reachs its size limit.
  * @ingroup EXCEPTIONMODULE
  */
-class NotEnoughMemoryException : public Exception
+class Cdr_DllAPI NotEnoughMemoryException : public Exception
 {
 public:
 
@@ -33,7 +33,7 @@ public:
      *
      * @param message A error message. This message pointer is copied.
      */
-    Cdr_DllAPI NotEnoughMemoryException(
+    NotEnoughMemoryException(
             const char* const& message) noexcept;
 
     /*!
@@ -41,7 +41,7 @@ public:
      *
      * @param ex NotEnoughMemoryException that will be copied.
      */
-    Cdr_DllAPI NotEnoughMemoryException(
+    NotEnoughMemoryException(
             const NotEnoughMemoryException& ex) noexcept;
 
 #if HAVE_CXX0X
@@ -50,7 +50,7 @@ public:
      *
      * @param ex NotEnoughMemoryException that will be moved.
      */
-    Cdr_DllAPI NotEnoughMemoryException(
+    NotEnoughMemoryException(
             NotEnoughMemoryException&& ex) noexcept;
 #endif // if HAVE_CXX0X
 
@@ -59,7 +59,7 @@ public:
      *
      * @param ex NotEnoughMemoryException that will be copied.
      */
-    Cdr_DllAPI NotEnoughMemoryException& operator =(
+    NotEnoughMemoryException& operator =(
             const NotEnoughMemoryException& ex) noexcept;
 
 #if HAVE_CXX0X
@@ -68,18 +68,18 @@ public:
      *
      * @param ex NotEnoughMemoryException that will be moved.
      */
-    Cdr_DllAPI NotEnoughMemoryException& operator =(
+    NotEnoughMemoryException& operator =(
             NotEnoughMemoryException&& ex) noexcept;
 #endif // if HAVE_CXX0X
 
     //! @brief Default constructor
-    virtual Cdr_DllAPI ~NotEnoughMemoryException() noexcept;
+    virtual ~NotEnoughMemoryException() noexcept;
 
     //! @brief This function throws the object as exception.
-    virtual Cdr_DllAPI void raise() const override;
+    virtual void raise() const override;
 
     //! @brief Default message used in the library.
-    static Cdr_DllAPI const char* const NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT;
+    static const char* const NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT;
 };
 }         //namespace exception
 }     //namespace fastcdr
