C#-托管变量变为非托管变量
托管变量变为非托管变量
string a="";
string b;
int str_size = Marshal.SizeOf(a);
IntPtr buffer = Marshal.AllocHGlobal(str_size); // 从进程的非托管内存中给DevBroadcastDeviceinterface分配内存
Marshal.StructureToPtr(b, buffer, true); // 将数据从托管对象封送到非托管内存块(dbi->buffer,删除旧的数据)
本文来自博客园,作者:꧁执笔小白꧂,转载请注明原文链接:https://www.cnblogs.com/qq2806933146xiaobai/p/16898788.html