C#引用C++函数指针参数的问题

江南小鱼 江南小鱼 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
C++函数原型
int WINAPI SMGP30_GetDeliverSM(int Ntimeout,SMGP30_DeliverResp *PdeliverResp);

其中
struct SMGP30_DeliverResp
{
char MsgID[20 + 1];
unsigned char uMsgFormat;
char SrcTermID[SMGP_ADDRS_LEN + 1];
unsigned char uIsReport;
unsigned char uMsgLength;
char MsgContent[MAX_SMGP_MSG_LEN + 1];
char DestTermID[SMGP_ADDRS_LEN +1];
char RecvTime[SMGP_RECVTIME_LEN + 1];
unsigned long uTLVMask;
unsigned char uTP_pid;
unsigned char uTP_udhi;
char LinkID[SMGP30_LINKID_LEN + 1];
unsigned char uSubmitMsgType;
unsigned char uSPDealResult;
unsigned char uSrcTermType;
char SrcTermPseudo[SMGP30_PESUDO_LEN + 1];
char Reserved[SMGP30_RESERVED_LEN + 1];
};

请问转换成C#外部函数引用,如下所示,是否准确?
[DllImport("SMEIDll.dll", EntryPoint = "SMGP30_GetDeliverSM")]
protected static extern int SMGP30_GetDeliverSM(int Ntimeout, out string MsgID, out string uMsgFormat, out byte uIsReport, out byte uMsgLength
, out string MsgContent, out string DestTermID, out string RecvTime, out long uTLVMask, out string uTP_pid, out string uTP_udhi
, out string LinkID, out string uSubmitMsgType, out string uSPDealResult, out string uSrcTermType, out string SrcTermPseudo
, out string Reserved)
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
江南小鱼
C# 111,129 成员 642,539 内容