TlbImp marshals array as single ref

  • Thread starter Thread starter Walter L. Williams
  • Start date Start date
W

Walter L. Williams

When I run TlbImp.exe on my COM dll, the IDL following has an array of
longs:

[local] HRESULT SomeMethod ([in] short nNumBlocks, [in, size_is(nNumBlocks)]
long *alBlocks, [out, retval] long *plRetVal);

The output creates this method, with a ref int where the array should be:

int SomeMethod (short nNumBlocks, ref int alBlocks);


I have also tried using 'long alBlocks[]' instead of the pointer, but that
doesn't work either. The [in, size_is(..)] *should* be indicating to TlbImp
that it's an array.

Can this be fixed (besides declaring the interface myself)?
====================================================
Walter Williams
Software Engineer
Sawtooth Software, Inc.
http://www.sawtoothsoftware.com
 
That article worked, thanks!

====================================================
Walter Williams
Software Engineer
Sawtooth Software, Inc.
http://www.sawtoothsoftware.com
----------------------------------------------------
"Do, or do not. There is no try."


Mattias Sjögren said:
The [in, size_is(..)] *should* be indicating to TlbImp
that it's an array.

Unfortunately the size_is information isn't stored in the typelib so
it's not available to TlbImp.

Can this be fixed (besides declaring the interface myself)?

See the section "Conformant C-Style Arrays" at
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconeditinginteropassembly.asp



Mattias
 
Back
Top