代码如下:
[DllImport("LClientDll.dll",EntryPoint="LClientStartDemo",ExactSpelling=false,CallingConvention=CallingConvention.Cdecl)]
public static extern int LClientStartDemo(string *host, string *port, string *oper, string *ch, int *flag);
[DllImport("LClientDll.dll",EntryPoint="LClientRcvDemo",ExactSpelling=false,CallingConvention=CallingConvention.Cdecl)]
public static extern int LClientRcvDemo(string *data);
提示指针和固定缓冲只能在不安全的上下文中使用。求教各位高手该如何改写!!!!!!
[DllImport("LClientDll.dll",EntryPoint="LClientStartDemo",ExactSpelling=false,CallingConvention=CallingConvention.Cdecl)]
public static extern int LClientStartDemo(string *host, string *port, string *oper, string *ch, int *flag);
[DllImport("LClientDll.dll",EntryPoint="LClientRcvDemo",ExactSpelling=false,CallingConvention=CallingConvention.Cdecl)]
public static extern int LClientRcvDemo(string *data);
提示指针和固定缓冲只能在不安全的上下文中使用。求教各位高手该如何改写!!!!!!
解决方案 »
- 我的win7已经装了VS2010,现在想再装个vs2012,请问同时安装会有冲突吗?
- 做了一个winfrom软件,用什么软件打包成EXE比较安全
- 关于用Marshal类和IntPtr分配非托管内存的问题(急!若帮忙解决,会加分的)
- 一个页面有两个js,分开用都正常,两个一起用只有一个有效过,求帮助啊
- c#嵌入暴风mps.dll组件问题
- 为什么取不到ActiveMdiChild?
- private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
- dategrivew重新加载问题
- 大家谁有自己写的C#垂直滚动条的代码??
- 求助:c#中结构体数组的一个问题
- C#WindowsForm做个一个温度计求看法
- 执行系统任务计划很奇怪的问题
改为stringbuilder
还不够具体么?把string * 改为stringbuilder。还要怎么具体?
public static extern int LClientStartDemo(string host, string port, string oper, string ch, int flag);
[DllImport("LClientDll.dll",EntryPoint="LClientRcvDemo",ExactSpelling=false,CallingConvention=CallingConvention.Cdecl)]
public static extern int LClientRcvDemo(StringBuilder sb);
[DllImport("LClientDll.dll",EntryPoint="LClientStop",ExactSpelling=false,CallingConvention=CallingConvention.Cdecl)]
public static extern int LClientStop();
改写成这样就可以了