TPlu=record //PLU信息结构
     Name:         PChar;  //品名,36个字符
     LFCode:       Longint; //码,1-999999,唯一识别
   end;
   PPLU=^TPLU;
   TPLUCluster=Array[0..3]of TPLU; //一个PLU簇包含4条PLU
   PPLUCluster=^TPLUCluster;
   THotkeyTable=Array[0..83]of LongInt;Function PBusTransferPLUCluster(PPC:PPLUCluster //PLU簇
                                ):Integer;far; external 'PbusDrv.dll';上面是DELPHI的调用接口的代码.在C#中应该怎么实现?

解决方案 »

  1.   

    C#调用DLL代码参考:
    [DllImport("Iphlpapi.dll")] 
    private static extern int SendARP(Int32 dest,Int32 host,ref Int64 mac,ref Int32 length); 至于Delphi的Record直接转成Struct类型就OK了呀
      

  2.   

    这样做:1、结构体定义:[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
    public struct TPlu
    {
       public string Name;
       public int    LFCode;
    }2、函数映射:[DllImport("User32.Dll")]
    public static extern int PBusTransferPLUCluster([MarshalAs(UnmanagedType.LPArray, SizeConst=3)]TPlu[] PPC);
      

  3.   

    指针对应 c# 的引用类型 ref即可。