We help IT Professionals succeed at work.
Get Started

MIDL error 2258

Last Modified: 2012-06-27

I am programming COM using c++. In my project I would like to treat ITest interfaces polimorphically the following way (only relevant lines of my IDL file are shown):
 interface ITest;

 [ ... ]
 interface ISample : IUnknown
  [...] HRESULT GetTest([in] REFIID riid,[out,iid_is(riid),retval] ITest** Test);

 [ ... ]
 interface ITest : IUnknown
 { ... };

 [ ... ]
 interface ITestChild : ITest
 { ... };

When compiling I get the following error:
error MIDL2258 : [IID_IS] may only be applied to pointers to interfaces

But if I copy the ITest interface _before_ ISample (and delete the forward declaration of it), I get no compile errors any more.

As far as I know the first (presented) syntax should also work. Or do I miss something?

Any help appreciated,
Kristof Strobl

Watch Question
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE