С# COM DLL Interface:
public interface IShowDialog
{
void showMessage(byte[] array);
}
and call it in unmanaged C++ application:
SAFEARRAY *array;
array = SafeArrayCreateVector(VT_BSTR, 0, 1);
long lidx = 0;
SafeArrayPutElement( array, &lidx, SysAllocString(L"test") );
hr = dlg->showMessage(array);
Result: 0x80131533 - COR_E_SAFEARRAYTYPEMISMATCH
The COM interface needs to be called from native code with a
SAFEARRAYwhose contents areVT_I1instances. You are providing insteadVT_BSTRvalues and hence receiving the error.You need to convert the string value into
VT_I1values and put those into the array.EDIT
The proper in C++ name is
VT_I1and notVT_BYTE