From 2efec4ce7bb31524d55596051adfe9fc3d6dacb1 Mon Sep 17 00:00:00 2001 From: jbarlow83 Date: Mon, 11 Mar 2019 15:28:29 -0700 Subject: [PATCH] Fix C++ exception handling when -fvisibility=hidden (#302) --- include/qpdf/DLL.h | 5 +++++ include/qpdf/QPDFExc.hh | 2 +- 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 ccd05fc..1e5d8a1 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 fe0aa1d..c538eb4 100644 --- a/include/qpdf/QPDFExc.hh +++ b/include/qpdf/QPDFExc.hh @@ -29,7 +29,7 @@ #include #include -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 c4e4871..cef8ea0 100644 --- a/include/qpdf/QPDFSystemError.hh +++ b/include/qpdf/QPDFSystemError.hh @@ -29,7 +29,7 @@ #include #include -class QPDFSystemError: public std::runtime_error +class QPDF_DLL_EXCEPTION QPDFSystemError: public std::runtime_error { public: QPDF_DLL -- libgit2 0.21.4