C#这边应该怎么调用?谁能写个Demo看看?

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);
这样有问题吗???

月关宝盒
浏览 127回答 2
2回答

交互式爱情

你写的应该没有问题,ref是否使用得看你是否需要这个参数进行值的返回。还有[DllImport("user2xml.dll", EntryPoint = "interfaceRank2Json", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]关于这个我通常只写[DllImport("user2xml.dll")]也没有出过什么问题

繁星点点滴滴

public static extern int interfaceRank2Json(string userData, StringBuilder outBuf, ref int outSize, ERankType ranktype);
打开App,查看更多内容
随时随地看视频慕课网APP