C char** and bool* inside a struct from C#

I have a struct in C like this:

typedef struct  {     unsigned int m_count;     FILTER_TYPE_E m_type;     char ** m_filterID;     bool *m_interface; } COMLIST_S; 

From what I have seen in the examples, it creates the struct like this in C:

std::vector<char*> buffer(com_filter.m_count); pp_filter = static_cast<char**>(&buffer[0]);  // fills the array  for (...) {    pp_filter[i] = ...; }  com_filter.m_filterID = pp_filter; 

From there I concluded that m_filterID is just an array of string. So I defined my C# side struct like this:

public struct FILTER_LIST {     public uint m_count;     public FILTER_TYPE_E m_type;     public string[] m_ppFilterID; // char**     public bool[] m_interface; // bool* } 

The question is, is my struct in C# correct? Also how to get the pointer of C# bool into struct because if it is a function parameter, I usually do ref bool m_interface.


EDIT: It turned out that m_interface is an array of bool, not a pointer pointed to a single bool value.

Professor Asked on October 26, 2020 in Android langue.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.