在c#中,接受到的缓冲区buf,只能区一个byte的数据了,虽然size是正确的。网上查了查,说要转char* 为IntPtr,配合Marshal.PtrToStructure 等,
知道我朋友帮个忙
谢谢

解决方案 »

  1.   

    //Copy data buffer data to another buffer
    [DllImport("Test.dll",  CharSet=CharSet.Ansi)]
    private static extern bool CopyToBuffer(int dbHandle,
    IntPtr buff,
    int buffSize);
    类似于这样
      

  2.   

    [DllImport("Test.dll")]
    public static extern void xx_send(byte[] buf,int size);
      

  3.   

    谢谢二位,
    [DllImport("Test.dll")]
    public static extern void xx_send(byte[] buf,int size);
    虽然可以收到 数据,size也正确,但buf只能访问一个字节,和size还是对不上,[DllImport("Test.dll",  CharSet=CharSet.Ansi)]
    private static extern bool CopyToBuffer(int dbHandle,
    IntPtr buff,
    int buffSize);
    这个函数自己实现么?