更新时间:2022-06-14 03:05:06
这里***的解决方案是用C语言编写包装函数,该函数仅限于非C ++类。通过PInvoke层[1],非平凡的C ++类基本上是不可拆的。而是让包装函数使用更传统的C签名,该签名易于P
The best solution here is to write a wrapper function in C which is limited to non-C++ classes. Non-trivial C++ classes are essentially unmarshable via the PInvoke layer [1]. Instead have the wrapper function use a more traditional C signature which is easy to PInvoke against
void findNeigborsWrapper(
Point p,
double maxDist,
Point** ppNeighbors,
size_t* pNeighborsLength)
[1]是的,在某些情况下您可以摆脱它,但这是例外,而不是规则。
[1] Yes there are certain cases where you can get away with it but that's the exception and not the rule.