Search code examples
c#c++.netcom-interoptlbimp

TlbImp error TI1036 failed to import SAFEARRAY(float)


I have a idl which contains a simple interface definition:

library DecoToniCfgLib
{

  importlib("stdole32.tlb");

  //....code
  //....code

  [
    object,
    uuid(A6F30650-53F5-4688-829A-C084BA1C7DC0),
    dual,
    nonextensible,
    helpstring("DecoToniConfig Interface"),
    pointer_default(unique)
  ]
  interface IDecoToniConfig : IDispatch
  {
    [id(1), helpstring("Opens the Tones config and returns the params")]
    HRESULT OpenToneConfigWindow([out, retval] TCodecParams* pVal);
    [id(2), helpstring("Opens the Tones config and returns the params in an array form")]
    HRESULT OpenToneConfigWindowArray([out, retval] SAFEARRAY(float)* pVal);
    [id(3), helpstring("Opens the masks config window")]
    HRESULT OpenMaskConfigWindow([out, retval] SAFEARRAY(TMask)* pVal);
  }; 

}

I add to it a method which returns a SAFEARRAY(float), but when I run TlbImp to create the import library for managed code I get:

TlbImp : error TI1036 : Cannot find 'System.Single[] OpenToneConfigWindowArray()' 
in 'DecoToniCfgLib.IDecoToniConfig' when implementing 'DecoToniCfgLib.IDecoToniConfig' 
in 'interop.DecoToniConfigLib.DecoToniConfigClass' 
from 'interop.DecoToniConfigLib, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'.

Where could be the problem?
Maybe I have to reference something? If so...how can I do?

Regards.


Solution

  • When I run

    tlbimp.exe DecoToniConfigLib.dll /out:interop.DecoToniConfigLib.dll
    

    It creates two files: DecoToniCfgLib.dll (the library defined into IDL) and interop.DecoToniConfigLib.dll

    The @hans-passant comment lights a lamp in my head and I delete these two file before run the tlbimp again...and It works.