Lets where to start, Of course basic types (int, double...) we don't need to anything special.
here are a couple of samples doing strings and arrays, note I prefer using the CString for the strings and Marshal::Copy for arrays
static void ArxMdg_doit1(void)
{
CString cstr = _T("To Managed and back");
System::String ^str = gcnew System::String(cstr);
acutPrintf(CString(str));
}
static void ArxMdg_doit2(void)
{
TCHAR *tchar = _T("To Managed and back");
System::String ^str = gcnew System::String(tchar);
pin_ptr<const TCHAR> pstr = PtrToStringChars(str);
acutPrintf(pstr);
}
static void ArxMdg_doit3(void)
{
double npt[3] = {10.0,100.0, 1000.0};
array<double> ^mpt = gcnew array<double>(3);
System::Runtime::InteropServices::Marshal::Copy
( System::IntPtr(&npt[0]),mpt, 0, mpt->Length);
acutPrintf(_T("%g, %g ,%g"),mpt[0], mpt[1], mpt[2]);
}
static void ArxMdg_doit4(void)
{
array<double> ^mpt = gcnew array<double>{10.0,100.0, 1000.0};
pin_ptr<const double> npt = &mpt[0];
acutPrintf(_T("%g, %g ,%g"),npt[0], npt[1], npt[2]);
}