2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Be more conservative about QPDF_DLL_CLASS with mingw (fixes #799)

* Define it even though previous experiments have shown it to be
  unnecessary since it seems like it may be necessary after all
* Add QPDF_DLL_CLASS to QPDFObjectHelper and QPDFDocumentHelper in
  case there's some future unknown reason why someone may want to have
  them and/or in case it helps with the weird
  QPDFNameTreeObjectHelper problem.
This commit is contained in:
Jay Berkenbilt 2022-10-06 08:05:48 -04:00
parent db6598b449
commit 5c5b4e640e
7 changed files with 31 additions and 8 deletions

View File

@ -179,9 +179,11 @@ CODING RULES
the shared object boundary (or "shared library boundary" -- we may
use either term in comments and documentation). In particular,
anything new derived from Pipeline or InputSource should be marked
with QPDF_DLL_CLASS, but we don't need to do it for QPDFObjectHelper
with QPDF_DLL_CLASS. We shouldn't need to do it for QPDFObjectHelper
or QPDFDocumentHelper subclasses since there's no reason to use
dynamic_cast with those.
dynamic_cast with those, but doing it anyway may help with some
strange cases for mingw or with some code generators that may
systematically do this for other reasons.
IMPORTANT NOTE ABOUT QPDF_DLL_CLASS: On mingw, the vtable for a
class with some virtual methods and no pure virtual methods seems

View File

@ -42,14 +42,16 @@
# define QPDF_DLL
# endif
# define QPDF_DLL_PRIVATE
# define QPDF_DLL_CLASS
#elif defined __GNUC__
# define QPDF_DLL __attribute__((visibility("default")))
# define QPDF_DLL_PRIVATE __attribute__((visibility("hidden")))
# define QPDF_DLL_CLASS QPDF_DLL
#else
# define QPDF_DLL
# define QPDF_DLL_PRIVATE
#endif
#ifdef __GNUC__
# define QPDF_DLL_CLASS QPDF_DLL
#else
# define QPDF_DLL_CLASS
#endif
@ -87,6 +89,9 @@ for a more in-depth discussion.
multi-platform and building both static and shared libraries that
use the same headers, so we don't bother.
* If we don't export base classes with mingw, the vtables don't end
up in the DLL.
* On Linux (and other similar systems):
* Common compilers such as gcc and clang export all symbols into the

View File

@ -36,7 +36,7 @@
// introduced to allow creation of higher level helper functions
// without polluting the public interface of QPDF.
class QPDFDocumentHelper
class QPDF_DLL_CLASS QPDFDocumentHelper
{
public:
QPDF_DLL
@ -45,7 +45,7 @@ class QPDFDocumentHelper
{
}
QPDF_DLL
virtual ~QPDFDocumentHelper() = default;
virtual ~QPDFDocumentHelper();
QPDF_DLL
QPDF&
getQPDF()

View File

@ -37,7 +37,7 @@
// introduced to allow creation of higher level helper functions
// without polluting the public interface of QPDFObjectHandle.
class QPDFObjectHelper
class QPDF_DLL_CLASS QPDFObjectHelper
{
public:
QPDF_DLL
@ -46,7 +46,7 @@ class QPDFObjectHelper
{
}
QPDF_DLL
virtual ~QPDFObjectHelper() = default;
virtual ~QPDFObjectHelper();
QPDF_DLL
QPDFObjectHandle
getObjectHandle()

View File

@ -59,6 +59,7 @@ set(libqpdf_SOURCES
QPDFAnnotationObjectHelper.cc
QPDFArgParser.cc
QPDFCryptoProvider.cc
QPDFDocumentHelper.cc
QPDFEFStreamObjectHelper.cc
QPDFEmbeddedFileDocumentHelper.cc
QPDFExc.cc
@ -74,6 +75,7 @@ set(libqpdf_SOURCES
QPDFNumberTreeObjectHelper.cc
QPDFObject.cc
QPDFObjectHandle.cc
QPDFObjectHelper.cc
QPDFObjGen.cc
QPDFOutlineDocumentHelper.cc
QPDFOutlineObjectHelper.cc

View File

@ -0,0 +1,7 @@
#include <qpdf/QPDFDocumentHelper.hh>
QPDFDocumentHelper::~QPDFDocumentHelper()
{
// Must be explicit and not inline -- see QPDF_DLL_CLASS in
// README-maintainer
}

View File

@ -0,0 +1,7 @@
#include <qpdf/QPDFObjectHelper.hh>
QPDFObjectHelper::~QPDFObjectHelper()
{
// Must be explicit and not inline -- see QPDF_DLL_CLASS in
// README-maintainer
}