C++ DLL interop c# Moose


I have exactly the same case as Moose example by @dale regarding polyline marshalling.
However on C++ side I am not using Rhino, just standalone C++ code.

I represent polylines collection like this: std::vector<std::vector< Point >> where Point is a struct.
In the moose example, the arrays of polylines are represented using ON_SimpleArray and ON_Polyline. What kind of native C datastructures I should use to mimic the same behavior? Can I do the same interop with C arrays e.g. Point[a][b] ?

To be honest I find hard time finding any example how to marsh arrays and jagged arrays without Rhino C++ SDK, just using C++ alone. Does anyone know how to interop jagged arrays using PInvoke with as minimal data copying as possible?

ON_Polyline inherits from ON_3dPointArray, which again inherits from ON_SimpleArray<ON_3dPoint>. ON_SimpleArray<T> is a C++ class template that extends basic array functionality, much like std::vector<T> from the standard library does, and is defined in opennurbs_array_defs.h, if you want to take a look for inspiration.
The Cherno on YouTube also has tutorials on how to extend the standard array and/or implement your own, custom vector-like data structure.