Mapping c struct in to c# struct
Posted on 2005-05-14
I am using some class library written in C and importing the methods using DllImport.
In the C class library there is a structure called iFvsMinutiaSet_t ( it is a "minutia set" class)
which contains minutia ( I hope you know about minutia or its not relevant to my question).
I want to write a minutiaSet structure and minutia structure to map c structs in order to use those classes but i am having trouble how to write "FvsMinutia_t ptable;" in C# struct.
I have written down the c struct below.
typedef struct iFvsMinutiaSet_t
int nbminutia; /* number of minutia set in the table */
int tablesize; /* max number of minutia that can be stored in the table */
FvsMinutia_t ptable; /* the minutia table starts here */
typedef struct FvsMinutia_t
/*! descibes the type of minutia */
/*! x position */
/*! y position */
/*! local minutia direction */
typedef /*@mutable@*/void* FvsMinutiaSet_t;
Actually struct iFvsMinutiaSet is a object which contain FvMinutia_t table
In the class library there is a function which returns a pointer to the start position of the table
I want to get the MinutiaSet into my c# struct and get the table to the c# struct and map each minutia in the table to my C# struct minutia and the problem is i don't know how to represent
FvsMinutia_t ptable; in my C# struct
here is the FvsMinutiaType_t
typedef enum FvsMinutiaType_t
FvsMinutiaTypeEnding = 0, /*!< line ending */
FvsMinutiaTypeBranching = 1, /*!< line branch */
FvsMinutiaTypeCore = 2, /*!< core point */
FvsMinutiaTypeDelta = 3, /*!< delta point */
but my main problem is here in the MinutiaSet it has defined like this
that mean an array which has one element right?
in the program it keeps on adding minutias into the table... and there is a method called MinutiaGetBuffer(MinutiaSet m);
FvsMinutia_t* MinutiaSetGetBuffer(FvsMinutiaSet_t min)
iFvsMinutiaSet_t* minutia = (iFvsMinutiaSet_t*)min;
FvsMinutia_t* pret = NULL;
pret = minutia->ptable;
return a pointer to the table of minutia .........
and after that you can loop through the array and get the values of the attributes of the minutia like
FvsMinutia_t* input_minutia = MinutiaSetGetBuffer(set1);
for(int n=0; n< size(" there a method which returns total no of minutia");n++)
Y = input_minutia[n].y;
So my question is What kind of array should i use in the C# , i know it should be a array of object type of Minutia.... can you please give me an idea?
It's quite urgent
Thanks in Advance,