Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

String Array Marshalling

I have a COM interface that I have to use for some development I'm doing and i can't get TlbImp to import the TLB file correctly.  The interface has one function that looks like this:

HRESULT MultiFieldChange([in] short shFieldCount, [in, size_is(shFieldCount)] short* ashField, [in, size_is(shFieldCount)] BSTR* abstrNewValues);

I have looked at the documentation and tried to fix the IL for the import by changing the arrays from references to the first element of each to marshal the full arrays.  I can get an array marshalled in for the array of short, but not the correct values and I can't get any but the first string in the BSTR array.  Does anyone know how to do this?

Robert Mihu
Friday, July 18, 2003


Does this help ?

http://groups.google.co.uk/groups?q=c%23+marshalling+string+array&hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&safe=off&selm=uLOhq%235nCHA.2224%40TK2MSFTNGP09&rnum=1

RJ
Wednesday, August 06, 2003

Thanks!  Looks like I was getting the array marshalled as a pointer correctly, but didn't know how to use it to retrieve the data.  This code was exactly what I needed.

Robert Mihu
Tuesday, August 19, 2003

*  Recent Topics

*  Fog Creek Home