求救,C# 调用C编写的dll问题
C原型:
typedef enum _SUPPORT_LAYER
{
HDLC = 0x01,
TCPIP,
UDPIP
}SUPPORT_LAYER;
typedef union _ADDR
{
struct
{
unsigned int ServerLowerAddr : 14; //服务器低地址
unsigned int ServerUpperAddr : 14; //服务器高地址
unsigned int res : 4;
unsigned char ClientAddr;
unsigned char ServerAddrLen;
}HDLC_ADDR1;
struct
{
unsigned int ServerAddr : 28;
unsigned int res : 4;
unsigned char ClientAddr;
unsigned char ServerAddrLen;
}HDLC_ADDR2;
struct
{
unsigned int Client_TCP_Port;
unsigned int Server_TCP_Port;
unsigned char Client_IP_Addr[4];
unsigned char Server_IP_Addr[4];
}TCPIP_ADDR;
struct
{
unsigned int Client_wPort;
unsigned int Server_wPort;
unsigned int Client_UDP_Port;
unsigned int Server_UDP_Port;
unsigned char Client_IP_Addr[4];
unsigned char Server_IP_Addr[4];
}UDPIP_ADDR;
}ADDR;
int ProcessServicePrimitive(unsigned char **OUTData, unsigned int &OUTDataLen,SUPPORT_LAYER SupportLayerType, ADDR Addr,const unsigned char *Xml, unsigned int XmlLen);
请问如何用C#调用ProcessServicePrimitive参数?
------解决方案--------------------Union应该是共享地址的,大小为最大的结构体所占的大小
[StructLayout(LayoutKind.Explicit,Size=24)]
public struct ADDR
{
[FieldOffset(0)]
public HDLC_ADDR1 a;
&nbs