What is the best way to get a set of unmanaged structs to C#.
I have the following structs:
typedef struct
{
unsigned char Angle[4];
unsigned char Rayon[3];
} StructPointPolaire;
//---------------------------------------------------------------------------
typedef struct
{
StructPointPolaire PointPolaire[36];
}StructForme36Points;
...
typedef struct
{
StructForme36Points Forme36Points;
...//more structs with similar data
char FinFichier[3];
} StructFormatMo1;
StructFormatMo1 is inside an unmanaged c++ class for which I have a
managed wrapper. The structs are filed in the constructor.
I need to access StructFormatMo1 (and the structs inside of course) in
C#. I won't be modifying the data and sending back to the c++
objects.
Thank you very much,
John
Ben Voigt - 07 May 2007 15:56 GMT
> What is the best way to get a set of unmanaged structs to C#.
>
[quoted text clipped - 5 lines]
> } StructPointPolaire;
> //---------------------------------------------------------------------------
Use an unsafe C# struct with the fixed keyword.
C++ unsigned char corresponds to C# byte.
> typedef struct
> {
[quoted text clipped - 17 lines]
> Thank you very much,
> John