日期:2014-05-18  浏览次数:20708 次

平台调用----封送结构体指针。
请教你   一个问题。
C定义如下:
BOOL     effnEDClientCheckPointInfoByTime(
efSTReadRtInfoRequest*pReqBuffer,//
efSTReadRtInfoResponse   *   pResBuffer,//
unsigned long   Count   //
);
结构如下:
#define   EFMI_POINTNAMELENGTH 48
#define   EFMI_POINTCOMMLENGTH EFMI_POINTNAMELENGTH

//查询实时记录请求包结构

typedef   struct   defefSTReadRtInfoRequest{
long   time; //
char   pointName[EFMI_POINTNAMELENGTH+1];//EFMI_POINTNAMELENGTH+1;
char   ednaServ[EFMI_POINTCOMMLENGTH+1]; //  
}efSTReadRtInfoRequest;


//查询实时记录回复包结构

typedef   struct   defefSTReadRtResponse{

double   value;
long   time;
unsigned   short   status;//
char   pointName[EFMI_POINTNAMELENGTH+1];//
}efSTReadRtInfoResponse;

c#================

        [StructLayout(LayoutKind.Sequential,   CharSet   =   CharSet.Ansi)]
        public   struct   defefSTReadRtInfoRequest
        {
                public   Int32   time;
                [MarshalAs(UnmanagedType.ByValArray,   SizeConst   =   49)]
                public   byte[]   pointName;//
                [MarshalAs(UnmanagedType.ByValArray,   SizeConst   =   49)]
                public   byte[]   ednaServ;//


        }

        //****************************************************************
        [StructLayout(LayoutKind.Sequential,   CharSet   =   CharSet.Ansi)]
        public   struct   defefSTReadRtResponse
        {
                public   double   value;
                public   Int32   time;
                public   UInt16   status;
                [MarshalAs(UnmanagedType.ByValArray,   SizeConst   =   49)]
                public   byte[]   pointName;//

        };

  [DllImport( "efEDClient.dll ",   EntryPoint   =   "effnEDClientInit ",   CharSet   =   CharSet.Ansi)]
                public   static   extern   bool   effnEDClientInit();
               
[DllImport( "efEDClient.dll ",   EntryPoint   =   "effnEDClientCheckPointInfoByTimeEx ",   CharSet   =   CharSet.Ansi)]
                public   static   extern   bool   effnEDClientCheckPointInfoByTimeEx(ref   defefSTReadRtInfoRequest   requestBuffer,   out   defefSTReadRtResponse   responseBuffer,   UInt32   count);


string[]   p   =   new   string[4]   {   "GDHYSSIS.U31_RTS.1EHC:C47.RO01 ",