本帖最后由 yardloun 于 2012-03-29 21:22:50 编辑

解决方案 »

  1.   

    用IntPtr
     [DllImport("TPalg.dll", CharSet = CharSet.Auto)] //
      public static extern int GetYC_GD(IntPtr pData);IntPtr p = System.Runtime.InteropServices.Marshal.AllocHGlobal(32);
    //32个字节的内容
    GetYC_GD(p);
    //...读p
    System.Runtime.InteropServices.Marshal.FreeHGlobal(p);
      

  2.   

    定义
    [DllImport("TPalg.dll", CharSet = CharSet.Auto)] 
    public static extern int GetYC_GD([MarshalAs(UnmanagedType.LPArray)]byte[] pData);调用byte[] pData=new byte[32];GetYC_GD(System.Text.Encoding.ASCII.GetBytes(pData));