Question

How can i convert interoperatability between a c++/CLI Array and a native c++ array AND VICE VERSA.

array^ Cpluspluss_CLI_ManagedArray;

unsigned char* UnmanagedArray;

I found the System::Runtime::InteropServices::Marshal; (IntPtr) there is so much of information for a first timer like me (to CLI) So I'm not sure about which one to use.

Thank you

Raj

Was it helpful?

Solution

// unmanaged to managed...

IntPtr ptr((unsigned char*)UnmanagedArray);

array< Byte>^Cpluspluss_CLI_ManagedArray = gcnew array(UnmanagedArrayLength);

Marshal::Copy(ptr, Cpluspluss_CLI_ManagedArray, 0, UnmanagedArrayLength);

// unmanaged to managed... See this Post

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top