title: Passing vector struct between C++ and C#
body: <p>I have c++ unmanaged code that i want to access from c#. So i followed some tutorials and i build a dll for my project (only one class btw). Now i want to use it from c#, and i'm using p/invoke as follows.</p>
  
  <p>my question is: is it possible to marshall my windows point so i can pass it as a vector into my c++ code? i can change all the code (except the qwindows point, but i can make my own point). IS there a solution where i dont have to create a c wrapper? i was following this question: <a href="https://stackoverflow.com/questions/6723881/how-to-call-an-unmanaged-c-function-with-a-stdvectoriterator-as-paramete">How to call an unmanaged C++ function with a std::vector&lt;&gt;::iterator as parameter from C#?</a></p>
  
  <p>many thanks1
  ps, i found a "solution" but i cant view it <a href="http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_21461195.html" rel="nofollow noreferrer">http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_21461195.html</a></p>
  
  <p>c# </p>
  
  <pre><code>using Point = System.Windows.Point;
  
  class CPlusPlusWrapper
  {
  
      [DllImport("EmotionsDLL.dll", EntryPoint = "calibrate_to_file")]
      static extern int calibrate_to_file(vector&lt;points&gt; pontos);//marshall here
  
      [DllImport("EmotionsDLL.dll", EntryPoint = "calibration_neutral")]
      static extern int calibration_neutral();
      /// &lt;summary&gt;
      /// wraps c++ project into c#
      /// &lt;/summary&gt;
  
      public void calibrate_to_file() { 
  
  }
  </code></pre>
  
  <p>dll header</p>
  
  <pre><code>namespace EMOTIONSDLL
  {
      struct points{
          double x;
          double y;
          double z;
      };
  
      #define db at&lt;double&gt;
  
      class DLLDIR EMOTIONS
      {
      public:
  
          EMOTIONS();
  
          CvERTrees *  Rtree ;
  
  
          vector&lt;points&gt; mapear_kinect_porto(vector&lt;points&gt; pontos);
  
          void calibrate_to_file(vector&lt;points&gt; pontos);
  
          int calibration_neutral();
  
          int EmotionsRecognition();
      };
  }
  </code></pre>