From ec734bbe084f5f731406022aa90d346df38451ed Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Sun, 10 Dec 2023 08:25:36 +0100 Subject: [PATCH] Fix MSVC warning dllexport and extern are incompatible C4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation --- taglib/ogg/xiphcomment.h | 2 +- taglib/toolkit/tpropertymap.cpp | 6 +++++- taglib/toolkit/tpropertymap.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/taglib/ogg/xiphcomment.h b/taglib/ogg/xiphcomment.h index ca70a71f..2edbde2d 100644 --- a/taglib/ogg/xiphcomment.h +++ b/taglib/ogg/xiphcomment.h @@ -37,7 +37,7 @@ #ifdef _MSC_VER // Explained at end of tpropertymap.cpp -extern template class TAGLIB_EXPORT TagLib::Map; +extern template class TagLib::Map; #endif namespace TagLib { diff --git a/taglib/toolkit/tpropertymap.cpp b/taglib/toolkit/tpropertymap.cpp index 07fab3b1..61807742 100644 --- a/taglib/toolkit/tpropertymap.cpp +++ b/taglib/toolkit/tpropertymap.cpp @@ -205,5 +205,9 @@ PropertyMap &PropertyMap::operator=(const PropertyMap &other) // 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; +// Suppress warning "needs to have dll-interface to be used by clients", +// in the template, TAGLIB_EXPORT cannot be used on the members, therefore +// the private implemenation is exported too, but not accessible by clients. +#pragma warning(suppress: 4251) +template class TAGLIB_EXPORT TagLib::Map; #endif diff --git a/taglib/toolkit/tpropertymap.h b/taglib/toolkit/tpropertymap.h index c8683fac..98242008 100644 --- a/taglib/toolkit/tpropertymap.h +++ b/taglib/toolkit/tpropertymap.h @@ -31,7 +31,7 @@ #ifdef _MSC_VER // Explained at end of tpropertymap.cpp -extern template class TAGLIB_EXPORT TagLib::Map; +extern template class TagLib::Map; #endif namespace TagLib {