本文介绍了错误C3699和c ++ struct和c ++ / cli struct之间的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
c ++
typedef void (* callback_OnRspAuthenticate )(CThostFtdcRspAuthenticateField *,CThostFtdcRspInfoField *, int , bool );
struct CThostFtdcRspAuthenticateField
{
TThostFtdcBrokerIDType BrokerID;
TThostFtdcUserIDType UserID;
TThostFtdcProductInfoType UserProductInfo;
};
struct CThostFtdcRspInfoField
{
TThostFtdcErrorIDType ErrorID;
TThostFtdcErrorMsgType ErrorMsg;
};
C ++ / CLI
public delegate void delegate_OnRspAuthenticate(CThostFtdcRspAuthenticateField ^,CThostFtdcRspInfoField ^, int , bool );
public value struct CThostFtdcRspAuthenticateField
{
[MarshalAs(UnmanagedType :: ByValTStr,SizeConst = 11 )]
String ^ BrokerID;
[MarshalAs(UnmanagedType :: ByValTStr,SizeConst = 16 )]
String ^ UserID;
[MarshalAs(UnmanagedType :: ByValTStr,SizeConst = 11 )]
String ^ UserProductInfo;
};
public value struct CThostFtdcRspInfoField
{
Int32 ErrorID ;
[MarshalAs(UnmanagedType :: ByValTStr,SizeConst = 81 )]
String ^ ErrorMsg;
};
解决方案
c++
typedef void(*callback_OnRspAuthenticate)(CThostFtdcRspAuthenticateField*, CThostFtdcRspInfoField*, int, bool);
struct CThostFtdcRspAuthenticateField
{
TThostFtdcBrokerIDType BrokerID;
TThostFtdcUserIDType UserID;
TThostFtdcProductInfoType UserProductInfo;
};
struct CThostFtdcRspInfoField
{
TThostFtdcErrorIDType ErrorID;
TThostFtdcErrorMsgType ErrorMsg;
};
C++/CLI
public delegate void delegate_OnRspAuthenticate(CThostFtdcRspAuthenticateField^, CThostFtdcRspInfoField^, int, bool);
public value struct CThostFtdcRspAuthenticateField { [MarshalAs(UnmanagedType::ByValTStr, SizeConst = 11)] String^ BrokerID; [MarshalAs(UnmanagedType::ByValTStr, SizeConst = 16)] String^ UserID; [MarshalAs(UnmanagedType::ByValTStr, SizeConst = 11)] String^ UserProductInfo; };
public value struct CThostFtdcRspInfoField { Int32 ErrorID; [MarshalAs(UnmanagedType::ByValTStr, SizeConst = 81)] String^ ErrorMsg; };
解决方案
这篇关于错误C3699和c ++ struct和c ++ / cli struct之间的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!