TlbImp marshals array as single ref

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
 
W

Walter L. Williams

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top