New to C++/WinRT and haivng some trouble marshalling data when trying to export a single C++ class using C++/WinRT for use in a .Net application.
I created a C++ Windows Runtime Component (Windows Universal) in Visual Studio 2017 v15.7.4.
This is the signature of the C++ function I am trying to use as it exists in the header file I copied into C++/WinRT project
public:
short Carryout(unsigned char* p, unsigned short* pCh1, unsigned short* pCh2, unsigned short* pCh3, unsigned char* pCePa, unsigned short* pTAc);
If its important fot context, the function takes a array of bytes p as input and spits out 5 arrays derived from it: pCh1, pCh2, pCh3, pCePa, pTAc.
Now in .Net application I declared new instance of the class from WinRT and setup all of the buffers just as an example:
byte[] dataBlock = GetDataBlock();
ushort[] ch1s = new ushort[4096];
ushort[] ch2s = new ushort[4096];
ushort[] ch3s = new ushort[4096];
byte[] cepa = new byte[4096];
ushort[] tac = new ushort[1024];
WinRTClass wrtClass = new WinRTClass();
short x = wrtClass.Carryout(dataBlock, out ch1s, out ch2s, out ch3s, out cepa, out tac);
VS tells me this isnt correct because signature doesnt match. Checking Definition of Carryout function brings up (what I assume to be) an automatically generated header file (has "from metadata" in its description) and the signature of the Carryout function in it is quite different:
public short Carryout(out byte p, out ushort pCh1, out ushort pCh2, out ushort pCh3, out byte pCePa, out ushort pTAc);
Note that function arguments are not arrays, but rather a byte/ushort types. Also, first argument is is not supposed to be an out
type. What is the proper way to address this discrepancy with this automatically generated header?
I would rather not make any changes to the C++ code: it has rather complex data manipulation inside, and easily decades of runtime assuring that it all works correctly.
Thank you in advance!