diff options
author | jbarlow83 <jbarlow83@users.noreply.github.com> | 2019-03-11 23:28:29 +0100 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2019-03-11 23:28:29 +0100 |
commit | 2efec4ce7bb31524d55596051adfe9fc3d6dacb1 (patch) | |
tree | 7d14773414232390b9cdb8b96e69ca406498c0df | |
parent | af42fe9dafd0a98adedf933829f70e50f3e49440 (diff) | |
download | qpdf-2efec4ce7bb31524d55596051adfe9fc3d6dacb1.tar.zst |
Fix C++ exception handling when -fvisibility=hidden (#302)
Fix C++ exception handling when -fvisibility=hidden
Ensure that QPDFExc and QPDFSystemError are marked visible, so that their typeinfo will not be
suppressed when -fvisibility=hidden.
Details:
https://gcc.gnu.org/wiki/Visibility
-rw-r--r-- | include/qpdf/DLL.h | 5 | ||||
-rw-r--r-- | include/qpdf/QPDFExc.hh | 2 | ||||
-rw-r--r-- | include/qpdf/QPDFSystemError.hh | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/qpdf/DLL.h b/include/qpdf/DLL.h index ccd05fce..1e5d8a1a 100644 --- a/include/qpdf/DLL.h +++ b/include/qpdf/DLL.h @@ -25,8 +25,13 @@ #if defined(_WIN32) && defined(DLL_EXPORT) # define QPDF_DLL __declspec(dllexport) +# define QPDF_DLL_EXCEPTION +#elif __GNUC__ >= 4 +# define QPDF_DLL __attribute__ ((visibility ("default"))) +# define QPDF_DLL_EXCEPTION __attribute__ ((visibility ("default"))) #else # define QPDF_DLL +# define QPDF_DLL_EXCEPTION #endif #endif /* QPDF_DLL_HH */ diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh index fe0aa1d5..c538eb4d 100644 --- a/include/qpdf/QPDFExc.hh +++ b/include/qpdf/QPDFExc.hh @@ -29,7 +29,7 @@ #include <string> #include <stdexcept> -class QPDFExc: public std::runtime_error +class QPDF_DLL_EXCEPTION QPDFExc: public std::runtime_error { public: QPDF_DLL diff --git a/include/qpdf/QPDFSystemError.hh b/include/qpdf/QPDFSystemError.hh index c4e48713..cef8ea08 100644 --- a/include/qpdf/QPDFSystemError.hh +++ b/include/qpdf/QPDFSystemError.hh @@ -29,7 +29,7 @@ #include <string> #include <stdexcept> -class QPDFSystemError: public std::runtime_error +class QPDF_DLL_EXCEPTION QPDFSystemError: public std::runtime_error { public: QPDF_DLL |