title: C++ DLL return string array, who should allocate the memory and how?
body: <p>I'm writing a c++/cli (warpper-)dll to use a C# Dll in native C++.
  One of the C# functions I'm wrapping returns a String-array <strong>of unknown size</strong>.
  I had the idea of using an export function like this:</p>
  
  <pre><code>__declspec(dllexport) void someFunc(char*** pStringArray);
  </code></pre>
  
  <p>With the idea in mind to pass a char*-array-pointer to the Dll. The Dll will fill the passed array with C# String-array.</p>
  
  <p>I don't know the size of the returned string array so I can't allocate memory to the pointer before calling the Dll function. Although it feels bad to allocate the memory on the heap within the Dll, because this could easy lead to a big memory leak. If possible, i want to avoid clearing the memory with another Dll call.</p>
  
  <p><strong>What is the best practice for this problem?</strong></p>
  
  <p>Are there better ways to return a string array of unknown size?</p>