c#からアクセスしたいc++アンマネージコードがあります。だから私はいくつかのチュートリアルに従い、私のプロジェクト用のdllをビルドしました(1つのクラスのみ)。今、私はそれをc#から使用したいと思います、そして私は次のようにp/invokeを使用しています。
私の質問は次のとおりです。Windowsポイントをマーシャリングして、c ++コードにベクトルとして渡すことはできますか?すべてのコードを変更できます(qwindowsポイントを除くが、独自のポイントを作成できます)。ACラッパーを作成する必要がない解決策はありますか?私はこの質問に従っていました:C#からのパラメーターとしてstd :: vector <> :: iteratorを使用して、アンマネージC ++関数を呼び出す方法は?
多くの感謝1ps、私は「解決策」を見つけましたが、それを見ることができませんhttp://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_21461195.html
c#
using Point = System.Windows.Point;
class CPlusPlusWrapper
{
[DllImport("EmotionsDLL.dll", EntryPoint = "calibrate_to_file")]
static extern int calibrate_to_file(vector<points> pontos);//marshall here
[DllImport("EmotionsDLL.dll", EntryPoint = "calibration_neutral")]
static extern int calibration_neutral();
/// <summary>
/// wraps c++ project into c#
/// </summary>
public void calibrate_to_file() {
}
dllヘッダー
namespace EMOTIONSDLL
{
struct points{
double x;
double y;
double z;
};
#define db at<double>
class DLLDIR EMOTIONS
{
public:
EMOTIONS();
CvERTrees * Rtree ;
vector<points> mapear_kinect_porto(vector<points> pontos);
void calibrate_to_file(vector<points> pontos);
int calibration_neutral();
int EmotionsRecognition();
};
}