アンマネージドC++では、私はC#から呼び出そうとしている関数を持っています。次のようにこのC++関数は次のとおりです。次のように関数が使用され、C++からC#のパラメータとしてstd :: vector <> :: iteratorを使用してアンマネージC++関数を呼び出す方法は?
typedef std::vector<Point> Points;
typedef std::back_insert_iterator<Points> OutputIterator;
namespace MYNAMESPACE{
DLLEXPORT OutputIterator convexHull(Points::iterator first, Points::iterator last, OutputIterator result);
}
呼び出されたとき:
Points points, result;
points.push_back(Point(0,0));
points.push_back(Point(10,0));
points.push_back(Point(10,10));
points.push_back(Point(6,5));
points.push_back(Point(4,1));
OutputIterator resultIterator = std::back_inserter(result);
MYNAMESPACE::convexHull(points.begin(), points.end(), resultIterator);
std::cout << result.size() << " points on the convex hull" << std::endl;
私はC#のコードを書き始めましたが、私はどのようなタイプのさっぱりだが私が合格する必要があります。
[DllImport("unmanagedCode.dll", EntryPoint = "convexHull", CallingConvention = CallingConvention.StdCall)]
public static extern ???<Point> convex_hull_2(???<Point> start, ???<Point> last, ???<Point> result);
ポイント構造をC#でちょうどです:
struct Point{
double x;
double y;
}
配列やポイントのリストを渡す場合ですか?
私はC++のソースを持っており、関数のパラメータを変更することができます。 C#から呼び出す方が簡単な別の型のパラメータがありますか?