MSVC hack to avoid multiply defined symbols

...as reported (at least with clang-cl and --disable-pch) now, apparently after
e523053587 "simplify ORefVector code":

> [build LNK] Library/filelo.dll
> idbtools.lib(dbtoolslo.dll) : error LNK2005: "public: long const & __cdecl std::vector<long,class std::allocator<long> >::operator[](unsigned __int64)const " (??A?$vector@JV?$allocator@J@std@@@std@@QEBAAEBJ_K@Z) already defined in fanalyzer.o
> idbtools.lib(dbtoolslo.dll) : error LNK2005: "public: unsigned __int64 __cdecl std::vector<long,class std::allocator<long> >::size(void)const " (?size@?$vector@JV?$allocator@J@std@@@std@@QEBA_KXZ) already defined in fanalyzer.o
>    Creating library C:/lo-clang/core/workdir/LinkTarget/Library/ifile.lib and object C:/lo-clang/core/workdir/LinkTarget/Library/ifile.exp
> C:\lo-clang\core\instdir\program\filelo.dll : fatal error LNK1169: one or more multiply defined symbols found

(The fix strategy is the same as in e.g.
177f5c2e50 "Proper fix for multiply defined
SfxEnumItem<sal_uInt16> with MSVC".)

Change-Id: Ie30fb21471e5cbe492486e3f0b76d50f67686253
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90803
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2020-03-20 16:02:19 +01:00
parent ada297f24b
commit 81164d233e

View file

@ -89,17 +89,19 @@ namespace connectivity
};
// MSVC hack to avoid multiply defined std::vector-related symbols:
class OKeySet_Base: public ORefVector<sal_Int32> {};
/**
The class OKeySet is a refcountable vector which also has a state.
This state gives information about if the keyset is fixed.
*/
class OOO_DLLPUBLIC_DBTOOLS OKeySet : public ORefVector<sal_Int32>
class OOO_DLLPUBLIC_DBTOOLS OKeySet : public OKeySet_Base
{
bool m_bFrozen;
public:
OKeySet()
: ORefVector<sal_Int32>()
, m_bFrozen(false){}
: m_bFrozen(false){}
bool isFrozen() const { return m_bFrozen; }
void setFrozen() { m_bFrozen = true; }