CLR c++/CLI 如何返回多个返回值

 

接口函数定义

public ref class MWWDianzhuHandle:public ICloneable
{......

int scanNewInput(interior_ptr<String ^> sUser, interior_ptr<String ^> sGuest, interior_ptr<String ^> sLastInput, int nStartItemIndex)
{
CString strUser, strGuest, strLastInput;

int res = m_Impl->ScanNewInput(strUser, strGuest, strLastInput, nStartItemIndex);
*sUser = gcnew String(strUser);
*sGuest = gcnew String(strGuest);
*sLastInput = gcnew String(strLastInput);
return res;
}

调用方法

wwHandle.scanNewInput(ref sUser, ref sGuest, ref sLastInput, 0);

 

 

 

 

 

 

int scanNewInput(String ^ sUser, String ^ sGuest, String ^ sLastInput, int nStartItemIndex)
{
CString strUser, strGuest, strLastInput;

int res = m_Impl->ScanNewInput(strUser, strGuest, strLastInput, nStartItemIndex);
sUser = gcnew String(strUser);
sGuest = gcnew String(strGuest);
sLastInput = gcnew String(strLastInput);
return res;
}

相关文章: