Visual Studio 2017 - C2338 Error on COM_INTERFACE_ENTRY2

  • Thread starter Thread starter RexChng
  • Start date Start date
R

RexChng

Guest
Hello,

Our code run well on VS2010/13, however it got C2338 Error 'Derived' Class must inherit from 'Base' after upgrade to VS2017.

Orignal code is like:

BEGIN_COM_MAP(PreInterposeThunk<IDispatch>)
COM_INTERFACE_ENTRY2(IDispatch, IUnknown)

I found the Atlcom.h was changed from VS2013 to VS2017.

In VS2013, it is:

#define COM_INTERFACE_ENTRY2(x, x2)\
{&_ATL_IIDOF(x),\
reinterpret_cast<DWORD_PTR>(static_cast<x*>(static_cast<x2*>(reinterpret_cast<_ComMapClass*>(8))))-8,\
_ATL_SIMPLEMAPENTRY},

While in VS2017, it changed to:

#define COM_INTERFACE_ENTRY2(x, x2)\
{&_ATL_IIDOF(x),\
ATL::AtlVerifyInheritance<x, x2>::value + (reinterpret_cast<DWORD_PTR>(static_cast<x*>(static_cast<x2*>(reinterpret_cast<_ComMapClass*>(_ATL_PACKING))))-_ATL_PACKING),\
_ATL_SIMPLEMAPENTRY},

Did anybody meet the same issue? Any suggestions? Thanks in advance.

Continue reading...
 
Back
Top