I want to write a plugin for a program. The program can only use C/C++ *.dll libraries. I want to write my plugin in C# though, so I thought I could just call my C# functions from the C++ dll through COM. This works fine but now I need to access a struct provided by the original program. In C++ this struct looks like this:
struct asdf{
char mc[64];
double md[10];
unsigned char muc[5];
unsigned char muc0 : 1;
unsigned char muc1 : 1;
unsigned char muc2 : 6;
unsigned char muc3;
another_struct st;
};
To be able to pass that struct to C# as a parameter I tried to built exactly the same struct in C#. I tried the following, but it gives me an access violation:
struct asdf{
char[] mc;
double[] md;
byte[] muc;
byte muc0;
byte muc1;
byte muc2;
byte muc3;
another_struct st;
};
What do I have to change?