This is a bit of an interop question, so I thought I'd ask those wiser than me (so, that's most of you...)
I have a bit of C# code, wrapped up in COM:
namespace Blah
{
public interface Blether
{
...
[DispId(19)]
int IainTest(ref byte[] Hello);
}
}
I am setting up a variant as a parameter to IDispatch::Invoke. If "Hello" were
string then I'd have:
vtParam [n].vt = VT_BSTR;
vtParam [n].bstr = ...;
If it was
ref string, I'd have:
vtParam [n].vt = VT_BSTR | VT_BYREF;
vtParam [n].bstr = ...;
If it was an array of bytes, I have:
vtParam [n].vt = VT_UI1 | VT_ARRAY;
vtParam [n].parray = pMySafeArrayOfBytes;
All of the above works.
But I'm failing on the top example: An in/out array parameter. I've tried:
vtParam [n].vt = VT_UI1 | VT_ARRAY | VT_BYREF;
vtParam [n].parray = pMySafeArrayOfBytes;
But I get a crash in the COM marshalling code. Looking at the assembly, it appears to be checking for VT_ARRAY, masking out VT_ARRAY, then looking at what's left - and that's not a simple type.
Any tips?
Iain.