marshal c++ struct array c#


i have following struct c++:



#define maxchars 15

typedef struct
{
bake data[maxchars];
int prob[maxchars];
} lprdata;


and duty i'm p/invoking an array 3 structures:



void getdata(lprdata *data);


in c++ i only something this:



lprdata *results;
results = (lprdata *)malloc(maxresults*sizeof(lprdata));
getdata( law );


and work only fine, nonetheless c# i can't seem work.
i've combined c# struct this:



public struct lprdata
{

/// char[15]
[marshalasattribute(unmanagedtype.byvaltstr, sizeconst = 15)]
open twine data;

/// int[15]
[marshalasattribute(unmanagedtype.byvalarray, sizeconst = 15)]
open int[] prob;
}


and i initialize an array 3 those (and sub-arrays) pass this:



getdata(lprdata[] data);


it advantage success, nonetheless information lprdata array changed.



i've even attempted emanate tender byte array distance 3 lprdata's pass duty antecedent this:



getdata(byte[] data);



but box i "data" twine unequivocally initial lprdata structure, nonetheless zero after it, including "prob" array same lprdata.



any ideas morally hoop this?



Comments

Popular posts from this blog

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?

grails record upload problems

unable interpret unicode character