Home > Net >  C # call C generated DLL, the nested structure in C, substructure belt * body, defined in C #?
C # call C generated DLL, the nested structure in C, substructure belt * body, defined in C #?

Time:10-03

C + + code:
Typedef struct
{
Unsigned int port_address: 12;
Unsigned int port_size: 3;
Unsigned int port_type: 1;
} TS_PORT_CONFIG;

Typedef struct
{
TS_PORT_CONFIG * p_ts_port_config;
Unsigned short c_ts_port_config;
Unsigned short supervision_interval;

} TS_CONFIG;

Extern "C" __declspec (dllexport) unsigned short lp_init (unsigned char ts_id, TS_CONFIG * p_descriptor)
{
Return p_descriptor - & gt; Supervision_interval;
}


In c # how to define the two structure? The key is TS_CONFIG structure inside TS_PORT_CONFIG * don't know how to define,

CodePudding user response:

Struct A
{
Struct B
}

Struct B
{
}

So to write, but please pay attention to allocate memory, if you don't feel such insurance can substitute intprt (of course intptr values you have to take to)

CodePudding user response:

reference 1st floor wanghui0380 response:
struct A
{
Struct B
}

Struct B
{
}

So to write, but please pay attention to allocate memory, if you don't feel such insurance can substitute intprt (of course intptr value you have to take to)

So no, inside the c project take less than the value of c #,,,
  •  Tags:  
  • C#
  • Related