Fix MSVC warning needs to have dll-interface (#1185)

Unfortunately, MSVC exports everything (not only public members) when
__declspec(dllexport) is set at the class level via TAGLIB_EXPORT, which
leads to many "needs to have dll-interface to be used by clients" 4251
warnings issued by MSVC, because the std::unique_ptr pimpls are
exported too. As it is not possible to "unexport" private members,
such a warning has to be explicitly suppressed for these cases or
all public and protected class member now have to be exported
for classes derived from a template (StringList, ByteVectorList,
PropertyMap).
This commit is contained in:
Urs Fleisch
2023-12-10 17:03:40 +01:00
parent ec734bbe08
commit c9486731d9
104 changed files with 170 additions and 10 deletions

View File

@@ -86,6 +86,7 @@ namespace TagLib {
private:
class StringHandlerPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<StringHandlerPrivate> d;
};
@@ -201,6 +202,7 @@ namespace TagLib {
private:
class TagPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<TagPrivate> d;
};
} // namespace ID3v1

View File

@@ -172,6 +172,7 @@ namespace TagLib {
void parseFields(const ByteVector &data) override;
ByteVector renderFields() const override;
class AttachedPictureFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<AttachedPictureFramePrivate> d;
private:

View File

@@ -242,6 +242,7 @@ namespace TagLib {
ChapterFrame(const ID3v2::Header *tagHeader, const ByteVector &data, Header *h);
class ChapterFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<ChapterFramePrivate> d;
};
} // namespace ID3v2

View File

@@ -172,6 +172,7 @@ namespace TagLib {
CommentsFrame(const ByteVector &data, Header *h);
class CommentsFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<CommentsFramePrivate> d;
};

View File

@@ -178,6 +178,7 @@ namespace TagLib {
EventTimingCodesFrame(const ByteVector &data, Header *h);
class EventTimingCodesFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<EventTimingCodesFramePrivate> d;
};

View File

@@ -177,6 +177,7 @@ namespace TagLib {
GeneralEncapsulatedObjectFrame(const ByteVector &data, Header *h);
class GeneralEncapsulatedObjectFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<GeneralEncapsulatedObjectFramePrivate> d;
};
} // namespace ID3v2

View File

@@ -149,6 +149,7 @@ namespace TagLib {
OwnershipFrame(const ByteVector &data, Header *h);
class OwnershipFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<OwnershipFramePrivate> d;
};

View File

@@ -75,6 +75,7 @@ namespace TagLib {
PodcastFrame(const ByteVector &data, Header *h);
class PodcastFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<PodcastFramePrivate> d;
};

View File

@@ -131,6 +131,7 @@ namespace TagLib {
PopularimeterFrame(const ByteVector &data, Header *h);
class PopularimeterFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<PopularimeterFramePrivate> d;
};

View File

@@ -103,6 +103,7 @@ namespace TagLib {
PrivateFrame(const ByteVector &data, Header *h);
class PrivateFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<PrivateFramePrivate> d;
};

View File

@@ -219,6 +219,7 @@ namespace TagLib {
RelativeVolumeFrame(const ByteVector &data, Header *h);
class RelativeVolumeFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<RelativeVolumeFramePrivate> d;
};

View File

@@ -225,6 +225,7 @@ namespace TagLib {
SynchronizedLyricsFrame(const ByteVector &data, Header *h);
class SynchronizedLyricsFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<SynchronizedLyricsFramePrivate> d;
};

View File

@@ -251,6 +251,7 @@ namespace TagLib {
TableOfContentsFrame(const ID3v2::Header *tagHeader, const ByteVector &data, Header *h);
class TableOfContentsFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<TableOfContentsFramePrivate> d;
};
} // namespace ID3v2

View File

@@ -223,6 +223,7 @@ namespace TagLib {
*/
PropertyMap makeTMCLProperties() const;
class TextIdentificationFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<TextIdentificationFramePrivate> d;
};
@@ -318,6 +319,7 @@ namespace TagLib {
void checkFields();
class UserTextIdentificationFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<UserTextIdentificationFramePrivate> d;
};

View File

@@ -115,6 +115,7 @@ namespace TagLib {
UniqueFileIdentifierFrame(const ByteVector &data, Header *h);
class UniqueFileIdentifierFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<UniqueFileIdentifierFramePrivate> d;
};
} // namespace ID3v2

View File

@@ -72,6 +72,7 @@ namespace TagLib {
UnknownFrame(const ByteVector &data, Header *h);
class UnknownFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<UnknownFramePrivate> d;
};

View File

@@ -172,6 +172,7 @@ namespace TagLib {
UnsynchronizedLyricsFrame(const ByteVector &data, Header *h);
class UnsynchronizedLyricsFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<UnsynchronizedLyricsFramePrivate> d;
};

View File

@@ -85,6 +85,7 @@ namespace TagLib {
private:
class UrlLinkFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<UrlLinkFramePrivate> d;
};
@@ -182,6 +183,7 @@ namespace TagLib {
private:
class UserUrlLinkFramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<UserUrlLinkFramePrivate> d;
};

View File

@@ -85,6 +85,7 @@ namespace TagLib {
private:
class ExtendedHeaderPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<ExtendedHeaderPrivate> d;
};

View File

@@ -74,6 +74,7 @@ namespace TagLib {
private:
class FooterPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<FooterPrivate> d;
};

View File

@@ -264,6 +264,7 @@ namespace TagLib {
private:
class FramePrivate;
friend class FramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<FramePrivate> d;
};
@@ -427,6 +428,7 @@ namespace TagLib {
private:
class HeaderPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<HeaderPrivate> d;
};

View File

@@ -178,6 +178,7 @@ namespace TagLib {
static FrameFactory factory;
class FrameFactoryPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<FrameFactoryPrivate> d;
};

View File

@@ -167,6 +167,7 @@ namespace TagLib {
private:
class HeaderPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<HeaderPrivate> d;
};

View File

@@ -80,6 +80,7 @@ namespace TagLib {
private:
class Latin1StringHandlerPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<Latin1StringHandlerPrivate> d;
};
@@ -395,6 +396,7 @@ namespace TagLib {
private:
class TagPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<TagPrivate> d;
};

View File

@@ -328,6 +328,7 @@ namespace TagLib {
offset_t findID3v2(Properties::ReadStyle readStyle);
class FilePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<FilePrivate> d;
};
} // namespace MPEG

View File

@@ -193,6 +193,7 @@ namespace TagLib {
void parse(File *file, offset_t offset, bool checkLength);
class HeaderPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::shared_ptr<HeaderPrivate> d;
};
} // namespace MPEG

View File

@@ -133,6 +133,7 @@ namespace TagLib {
void read(File *file, ReadStyle readStyle);
class PropertiesPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace MPEG

View File

@@ -112,6 +112,7 @@ namespace TagLib {
void parse(const ByteVector &data);
class XingHeaderPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<XingHeaderPrivate> d;
};
} // namespace MPEG