我在 DLL 中有一个小型 C 库,我需要调用它的一些方法。
它使用指针和一些结构,但在其他方面非常简单。问题是我对 .NET 与非托管世界的互操作并不是非常了解,而且到目前为止我的尝试一直遇到内存访问冲突异常(可能是因为我没有得到完全正确的指针)。
谁能给我一些关于解决这个问题的最佳方法的指示(哦,双关语!)?
谢谢
extern vconfig_t *Pobsopen(Ppoly_t ** obstacles, int n_obstacles);
extern int Pobspath(vconfig_t * config, Ppoint_t p0, int poly0,
Ppoint_t p1, int poly1,
Ppolyline_t * output_route);
extern void Pobsclose(vconfig_t * config);
struct vconfig_t {
int Npoly;
int N;
Ppoint_t *P;
int *start;
int *next;
int *prev;
};
typedef struct Ppoly_t {
Ppoint_t *ps;
int pn;
} Ppoly_t;
typedef Ppoly_t Ppolyline_t;
typedef struct Pxy_t {
double x, y;
} Pxy_t;
typedef struct Pxy_t Ppoint_t;
typedef struct Pxy_t Pvector_t;