Tim79

I have a Managed C++ DLL which I'm using to wrap calls to a C Lib by a third party vendor. The input is a Word8 array and it's output is a Word16 array. I believe that the equivelant types are short and sbyte respectivly. I've spent the whole day trying to find out how to pass these arrays between the C# code and the C++ DLL. I'll just throw out that I'm using VS2005.

Thanks in Advance,
Tim


Re: Visual C# General Passing Arrays between C# and C++

IsshouFuuraibou

Well first off do you know if your Word8 and Word16 are signed or unsigned
Second you got your bit numbers flipped.
Word8 == sbyte or byte (signed or unsigned)
Word16 == short or ushort (signed or unsigned)

Second, what is the C library's function stub How does this compare to what your using for you P/Invoke stub





Re: Visual C# General Passing Arrays between C# and C++

Tim79

Sorry, I noticed I switched them around typing up the problem. Let me take a second shot at this and state the issue clearer.

I need to call C++ .Net DLL from C# sending in a Word8 array and getting back a Word16 array. The original data being sent in is simply a C# byte[] and the output I get back will be converted to a C# byte[] also. I can write whatever signature in C++ that I need to accomplish this. I also can pass the data byte array in any format as long as I can convert the byte array to a Word8 array. The Word8 and Word16 arrays are signed.

example signature
Word16 decode(Word8 inbuffer[]);