日期:2014-05-20  浏览次数:20860 次

C# 调用C++组件问题请教
C++的头文件(Comm.h)定义(截取)如下:
class   COMM_API   CCOMM
{
public:
typedef   struct   DEVICE_STRUCT
{
char   id[5];
int   function;
int   detection;
int   malfunction;
int   alarm;
char   datetime[20];
char   imagefilename[35];
}   DEVICE_TYPE;

DEVICE_TYPE   devices[MAX_DEVICE];     //   Contains   info   for   all   devices   connected   to   this   APS
//   Methods
/***********************************************************
Method   name: CCOMM()
Description: COMM   class   constructor.
Parameters: Nil
Return: Nil
Called   by: System
Comments: Nil
***********************************************************/
CCOMM();

/***********************************************************
Method   name: ~CCOMM()
Description: COMM   class   destructor.
Parameters: Nil
Return: Nil
Called   by: System
Comments: Nil
***********************************************************/
~CCOMM();

/***********************************************************
Method   name: SetUDPIPPort(char   ip[],   int   in,   int   out)
Description: Set   UDP   target   IP   address   and   port   numbers.
Parameters: char   ip[]   -   target   IP   address
int   in   -   port   for   incoming   socket
int   out   -   port   for   outgoing   socket
Return: Nil
Called   by: User
Comments: Nil
***********************************************************/
void   SetUDPIPPort(char   ip[],   int   in,   int   out);

/***********************************************************
Method   name: SetTCPPort(int   in)
Description: Set   TCP   port   number.
Parameters: int   in   -   port   for   incoming   socket
Return: Nil
Called   by: User
Comments: Nil
***********************************************************/
void   SetTCPPort(int   in);     //   Set   TCP   port   number

/***********************************************************
Method   name: Initialize()
Description: Initialize   UDP   and   TCP   communication   sockets.
Parameters: Nil
Return: int   -   1:OK,   0:Fail
Called   by: User
Comments: Nil
***********************************************************/
int   Initialize();

/***********************************************************
Method   name: Initialize(char   ip[],   int   in,   int   out,   int   TCPin)
Description: Initialize   UDP   and   TCP   communication   sockets.
Parameters: char   ip[]   -   target   IP   address
int   in   -   UDP   port   for   incoming   socket
int   out   -   UDP   port   for   outgoing   socket
int   TCPin   -   TCP   port   for   incoming   socket
Return: int   -   1:OK,   0:Fail
Called   by: User
Comments: Nil
***********************************************************/
int   Initialize(char   ip[],   int   in,   int   out,   int   TCPin);