解决方式:将托管 System.String 中的内容复制到非托管内存(Marshal.StringToHGlobalAnsi)

class
HttpsSend { [DllImport("httpsSend.dll")] public static extern IntPtr markInvoice(IntPtr url, IntPtr input); public static string Send(string url, string content) { IntPtr urlPtr = Marshal.StringToHGlobalAnsi(url); IntPtr contentPtr = Marshal.StringToHGlobalAnsi(content); IntPtr outPutIntPtr = markInvoice(urlPtr, contentPtr); string outPut = Marshal.PtrToStringAnsi(outPutIntPtr); return outPut; } }

 

相关文章:

  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-18
  • 2021-08-31
  • 2021-11-13
  • 2021-06-19
相关资源
相似解决方案