I have a C# function with following signature:
int Get1251Bytes(string source, byte[] result, Int32 lengthOfResult)
I call it from C++. I was informed by compiler that 2-nd param must have SAFEARRAY*
type. So I call it in this way:
SAFEARRAY* safeArray = SafeArrayCreateVector(VT_UI1, 0, arrayLength);
char str[] = {'s', 't', 'a', 'c', 'k', '\0'};
converter->Get1251Bytes(str, safeArray, arrayLength);
But safeArray is not updated, it still contains zores. But I tested Get1251Bytes
function in C# unit-test. It works properly and updates result
array. What am I doing wrong?