我再次陷入了将C结构编组到C#中的问题。这就是我想要编组的C#。
int GetParametersDescription(unsigned int *numParams,
OP_PARAMETER_INFO **parameterInfo,
unsigned int *numVars,
OP_VARIABLE_INFO **variableInfo);
numParams:模型参数的数量 parameterInfo:返回的参数结构列表。列表的大小为numParams numVars:模型变量的数量 variableInfo:返回的变量结构列表。列表的大小为numVars。
typedef struct OP_PARAMETER_INFO {
unsigned id; // Parameter Id
char *path; // Parameter's path in the model
char *name; // Parameter's label if any
char *alias; // Parameter's alias if any.
struct OP_VARIABLE_INFO *varInfo; // Pointer on OP_VARIABLE_INFO if variable exist
unsigned nbRows; // Number of rows for this parameter
unsigned nbCols; // Number of cols for this parameter
double *values; // List of values, nbValue = nbRows * nbCols
OP_SEARCH_RESULTS exist; // This is an enum
unsigned newParamId; // ID of the estimated parameter if does not exist
} OP_PARAMETER_INFO;
typedef struct OP_VARIABLE_INFO {
unsigned id; // Variable Id
char *name; // Variable name
unsigned int nbParams; // Number of parameters associated with the variable
struct OP_PARAMETER_INFO** param; // List of pointers of OP_PARAMETER_INFO structure
} OP_VARIABLE_INFO;
typedef enum {
OP_SEARCH_NOT_FOUND,
OP_SEARCH_FOUND_EXACT,
OP_SEARCH_FOUND_DIFFERENT,
OP_SEARCH_FOUND_ESTIMATION
} OP_SEARCH_RESULTS;
我确实试过用C#编写结构,但它们似乎都没有用。 你能帮我在C#中定义这些结构并用P / invoke方法调用它们并提取结构信息......