none
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
    "oaidl.idl";

    import "ocidl.idl";

    [

       object,

       uuid(7F9E1924-542B-49A4-8362-778604B4A824),

       oleautomation,

       helpstring("ICommand Interface"),

       pointer_default(unique)

    ]

    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

Answers

  • 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
    Moderator