diff --git a/taglib/mp4/mp4atom.h b/taglib/mp4/mp4atom.h index cbb0d10a..c1af4830 100644 --- a/taglib/mp4/mp4atom.h +++ b/taglib/mp4/mp4atom.h @@ -74,7 +74,7 @@ namespace TagLib { typedef TagLib::List AtomDataList; - class Atom + class TAGLIB_EXPORT Atom { public: Atom(File *file); @@ -92,7 +92,7 @@ namespace TagLib { }; //! Root-level atoms - class Atoms + class TAGLIB_EXPORT Atoms { public: Atoms(File *file); diff --git a/taglib/ogg/xiphcomment.h b/taglib/ogg/xiphcomment.h index 674d6169..7925fa03 100644 --- a/taglib/ogg/xiphcomment.h +++ b/taglib/ogg/xiphcomment.h @@ -35,6 +35,11 @@ #include "flacpicture.h" #include "taglib_export.h" +#ifdef _MSC_VER +// Explained at end of tpropertymap.cpp +extern template class TAGLIB_EXPORT TagLib::Map; +#endif + namespace TagLib { namespace Ogg { diff --git a/taglib/toolkit/tpropertymap.cpp b/taglib/toolkit/tpropertymap.cpp index b3e1ec3a..0876bcde 100644 --- a/taglib/toolkit/tpropertymap.cpp +++ b/taglib/toolkit/tpropertymap.cpp @@ -177,3 +177,12 @@ const StringList &PropertyMap::unsupportedData() const { return unsupported; } + +#ifdef _MSC_VER +// When building with shared libraries and tests, MSVC will fail with +// "already defined in test_opus.obj" as soon as operator[] of +// Ogg::FieldListMap is used because this will instantiate the same template +// Map. Therefore this template is instantiated here +// and declared extern in the headers using it. +template class TagLib::Map; +#endif diff --git a/taglib/toolkit/tpropertymap.h b/taglib/toolkit/tpropertymap.h index 27731a81..58bab904 100644 --- a/taglib/toolkit/tpropertymap.h +++ b/taglib/toolkit/tpropertymap.h @@ -29,6 +29,11 @@ #include "tmap.h" #include "tstringlist.h" +#ifdef _MSC_VER +// Explained at end of tpropertymap.cpp +extern template class TAGLIB_EXPORT TagLib::Map; +#endif + namespace TagLib { typedef Map SimplePropertyMap; diff --git a/taglib/toolkit/tstringlist.h b/taglib/toolkit/tstringlist.h index 41b7f6ec..ddf0f04d 100644 --- a/taglib/toolkit/tstringlist.h +++ b/taglib/toolkit/tstringlist.h @@ -110,6 +110,6 @@ namespace TagLib { * \related TagLib::StringList * Send the StringList to an output stream. */ -std::ostream &operator<<(std::ostream &s, const TagLib::StringList &l); +std::ostream TAGLIB_EXPORT &operator<<(std::ostream &s, const TagLib::StringList &l); #endif diff --git a/taglib/toolkit/tzlib.h b/taglib/toolkit/tzlib.h index b1f1fcaf..dab78280 100644 --- a/taglib/toolkit/tzlib.h +++ b/taglib/toolkit/tzlib.h @@ -39,7 +39,7 @@ namespace TagLib { /*! * Returns whether or not zlib is installed and ready to use. */ - bool isAvailable(); + bool TAGLIB_EXPORT isAvailable(); /*! * Decompress \a data by zlib.