Make tests work with BUILD_SHARED_LIBS=ON on Windows

This commit is contained in:
Urs Fleisch 2021-02-16 16:22:02 +01:00
parent 304ab20174
commit 844f07d32d
6 changed files with 23 additions and 4 deletions

View File

@ -74,7 +74,7 @@ namespace TagLib {
typedef TagLib::List<AtomData> 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);

View File

@ -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<TagLib::String, TagLib::StringList>;
#endif
namespace TagLib {
namespace Ogg {

View File

@ -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<String, StringList>. Therefore this template is instantiated here
// and declared extern in the headers using it.
template class TagLib::Map<TagLib::String, TagLib::StringList>;
#endif

View File

@ -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<TagLib::String, TagLib::StringList>;
#endif
namespace TagLib {
typedef Map<String,StringList> SimplePropertyMap;

View File

@ -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

View File

@ -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.