none
TlbImp : warning TI0000 RRS feed

  • Question

  • Hello All,
    I am trying to import a COM library, I use SAFEARRAY. I get a warning "TlbImp : warning TI0000 : The type library importer could not convert the signature for the member 'tagSAFEARRAY.rgsabound'" How should I go about this warning.

    Thanks a lot
    Monday, March 30, 2009 11:14 AM

Answers

  • Hmya, you did indeed edit the header file.  Of your derived class, TestCom.h.  The declaration must be:

       HRESULT __stdcall TestFunc1( VARIANT_BOOL t, short f, SAFEARRAY** dfg );

    to match the declaration of the base interface in TestCOM_h.h.  Type element type declaration must only appear in the .idl file.
    Hans Passant.
    • Marked as answer by RadiumBall Wednesday, April 1, 2009 12:36 AM
    Tuesday, March 31, 2009 4:22 PM
    Moderator
  • COM uses interface pointers.  An array of objects is a SAFEARRAY(ISomething*).  Or IDispatch.  Or IUnknown.  Or VARIANT, it depends.
    Hans Passant.
    • Marked as answer by RadiumBall Wednesday, April 1, 2009 12:36 AM
    Tuesday, March 31, 2009 6:03 PM
    Moderator

All replies

  • You'll have to post the IDL that generates that error.  Use the OleView.exe utility if necessary (File + View Type library).
    Hans Passant.
    Monday, March 30, 2009 11:41 AM
    Moderator
  • Here,
    This is the only place I use SAFEARRAY in the IDL

    HRESULT getOutputChannelData(

    int pos, int variation, SAFEARRAY* data);

    Monday, March 30, 2009 11:48 AM
  • You should declare the array type.  Something like:

      [id(1)] HRESULT getOutputChannelData([in] int pos, [in] int variation, [in,out] SAFEARRAY(int)* data);
    Hans Passant.
    Monday, March 30, 2009 12:18 PM
    Moderator
  • Sorry to say Hans,
    Now I get "error C2143: syntax error : missing ')' before '*'" in the .cpp and .h file of the implementing class.

    If you do not mind what is the idea with "SAFEARRAY(int)*"?
    Monday, March 30, 2009 12:26 PM
  • Hmm, I suspect you are changing the header file, not the .idl file.  It was rather odd that you posted a declaration without any attributes.  How are you generating the type library?

    The idea is that the element type of the array is known to clients of your type library.  Afaik, it is required for OLE Automation enabled COM components.
    Hans Passant.
    Monday, March 30, 2009 12:58 PM
    Moderator
  • Hello Hans,
    Ofcourse, I did modify the IDL file. Adding the attributes did not make change either.
    Type library is automatically generated by the MIDL compiler.
    Element of the SAFEARRAY is dynamic may be char/short/int/long/double/int64

    I still get "error C2143"

    Thanks again.
    Tuesday, March 31, 2009 11:09 AM
  • I don't know what you are doing.  Taking an example from my own code, an IDL declaration like this one:

      [id(21)]  HRESULT PrioritiesLeft([in,out] SAFEARRAY(int)* priorities, [out,retval] int* retval);

    gets translated by MIDL to:

            virtual /* [id] */ HRESULT STDMETHODCALLTYPE PrioritiesLeft(
                /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *priorities,
                /* [retval][out] */ int __RPC_FAR *retval) = 0;

    The SAFEARRAY type declaration should never make it into the generated .h file.  This isn't exactly the best forum to ask questions about IDL, I'd suggest the C++ General forum.
    Hans Passant.
    Tuesday, March 31, 2009 12:51 PM
    Moderator
  • Hello Hans,
    I shall post my question in the C++ general forum. But before that please have a look and try to compile the attachment http://www.wikiupload.com/download_page.php?id=111661

    Thanks
    Tuesday, March 31, 2009 3:09 PM
  • Hmya, you did indeed edit the header file.  Of your derived class, TestCom.h.  The declaration must be:

       HRESULT __stdcall TestFunc1( VARIANT_BOOL t, short f, SAFEARRAY** dfg );

    to match the declaration of the base interface in TestCOM_h.h.  Type element type declaration must only appear in the .idl file.
    Hans Passant.
    • Marked as answer by RadiumBall Wednesday, April 1, 2009 12:36 AM
    Tuesday, March 31, 2009 4:22 PM
    Moderator
  • That was fantastic Hans,
    But I now I have another problem and I think this would be related and falls in this forum.
    As I mentioned earlier

    "Element of the SAFEARRAY is dynamic may be char/short/int/long/double/int64"

    So I would like to have array of objects when imported into .NET and not an array of int's

    Thanks Again
    Tuesday, March 31, 2009 4:37 PM
  • COM uses interface pointers.  An array of objects is a SAFEARRAY(ISomething*).  Or IDispatch.  Or IUnknown.  Or VARIANT, it depends.
    Hans Passant.
    • Marked as answer by RadiumBall Wednesday, April 1, 2009 12:36 AM
    Tuesday, March 31, 2009 6:03 PM
    Moderator