title: C++ API return an array of a struct
body: <p>I would like to return an array of a struct in my C++ API (dll). I can already return a struct and use this in my C# test application.</p>
  
  <pre><code>struct CharacterInformation {
    int id;
    double x;
    double y;
    CharacterInformation(int ID, double X, double Y) : id(ID), x(X), y(Y) {}
  };
  
  extern "C" EXPORT_API CharacterInformation GetCharacterPositions(void) {
    //std::vector&lt;Character&gt; characters = simulator-&gt;getCharacters(); 
    //CharacterInformation characterInformationArray [] = { CharacterInformation(0, 1, 2) };
    //return characterInformationArray;
    CharacterInformation characterInformation = CharacterInformation(0,1,2);
    return characterInformation;
  
  }
  </code></pre>
  
  <p>How can I pass the array in this function. I have to do some memory management but I don't know what I have to do. </p>