SAFEARRAY(IUNKNOWN *) getting MIDL2456 warning RRS feed

  • Question

  • Trying to move a large project from building with Development Studio 2003 to Development Studio 2008. The COM interface is used to pass data, and there are several interfaces descibed in .IDL files that use SAFEARRAY(IUnknown *). They all get a MIDL2456 warning, I can not find that warning described anywhere and can not seem to find a way to not get the error.


    import "ocidl.idl";





       helpstring("ICommand Interface"),



    interface ICommand : IUnknown



       HRESULT testA(


          [in] SAFEARRAY( IUnknown * ) *InputA,

          [in, out] VARIANT *InOutA




    warning MIDL2456 : SAFEARRAY(interface pointer) doesn't work using midl generated proxy : [ Parameter 'InputA' of Procedure 'testA' ( Interface 'ICommand' ) ]


    Wednesday, May 27, 2009 8:25 PM


  • I'm at a bit of a loss why you would post this question in this forum.  However, the warning is valid, midl.exe has been improved a lot since 2003.  MIDL cannot possibly generate a proxy/stub that could marshal that array across threads or process boundaries.  It would need to know the real interface type for the array elements.  It is only a warning, most of all because it doesn't hurt when you don't actually try to marshal the array.  If you do, it won't work.

    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Wednesday, June 3, 2009 10:15 AM
    Wednesday, May 27, 2009 11:55 PM