Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 1.04 KB

compiler-error-c3138.md

File metadata and controls

38 lines (31 loc) · 1.04 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C3138
Compiler Error C3138
11/04/2016
C3138
C3138
364ee9e8-9358-410e-bd35-9c4a226a3753

Compiler Error C3138

'interface' : a 'attribute' interface must inherit from IDispatch, or from an interface that inherits from IDispatch

An interface with the dual or dispinterface attributes does not have IDispatch as a direct or indirect base interface.

The following example generates C3138:

// C3138.cpp
#include <unknwn.h>

[ object, uuid("77ac9240-6e9a-11d2-97de-0000f805d73b") ]
__interface IMyCustomInterface
{
   HRESULT mf1(void);
};

[ dispinterface, uuid("3536f8a0-6e9a-11d2-97de-0000f805d73b") ]
__interface IMyDispInterface : IUnknown
{
   [id(1)] HRESULT mf2(void);
};

[ object, dual, uuid("34e90a10-6e9a-11d2-97de-0000f805d73b") ]
__interface IMyDualInterface : IMyCustomInterface  // C3138 expected
{
   HRESULT mf3(void);
};