我有以下几行代码:
public static string getTrack1(string track1, int len)
{
IntPtr track1Ptr = UnsafeNativeMethods.Decrypt(track1, len);
Byte[] track1b = new Byte[200];
Marshal.Copy(track1Ptr, track1b, 0, track1b.Length);
return track1b.ToString();
}
解密方法的减速是:
internal static class UnsafeNativeMethods
{
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Decrypt(string track1, int dataLen);
}
我unsigned char*
从visual c++
代码中返回,每当我从代码中调用 dll 时,c#
它总是返回“ System.Byte[]
”而不是值。我在这里做错了marshal
吗?
请在这里帮助我