C++代码:extern "C" _declspec ( dllexport )int GAME2JSONAPI interfaceRank2Json(const char* strData, char* outBuf, int outSize,ERankType ranktype){MsBase64 base64 = strData;int bufSize = base64.DecodeLength();BYTE* buf = (BYTE*)EvMemAlloc(bufSize);bufSize = base64.Decode(buf);int ret = rank2json(buf, bufSize, outBuf, outSize,ranktype);EvMemFree(buf);return ret;}int interfaceRank2Json(const char* strData, char* outBuf, int outSize,ERankType ranktype);C#这边应该怎么调用??谁能写个Demo看看?[DllImport("user2xml.dll", EntryPoint = "interfaceRank2Json", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]public static extern int interfaceRank2Json(string userData, ref string outBuf, ref int outSize, ERankType ranktype);这样有问题吗???
2 回答
交互式爱情
TA贡献1712条经验 获得超3个赞
你写的应该没有问题,ref是否使用得看你是否需要这个参数进行值的返回。
还有[DllImport("user2xml.dll", EntryPoint = "interfaceRank2Json", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
关于这个我通常只写[DllImport("user2xml.dll")]也没有出过什么问题
繁星点点滴滴
TA贡献1803条经验 获得超3个赞
public static extern int interfaceRank2Json(string userData, StringBuilder outBuf, ref int outSize, ERankType ranktype);
添加回答
举报
0/150
提交
取消