title: How to pass two Strings from Swift to a C++ function, and getting an array of Integers?
body: <p>I am trying to pass two <code>Strings</code> from Swift to the C++ function, handle them there, and then return an array of integers (probally a vector), not sure yet.</p>
  
  <p>I've tried it with (C++ function declaration):</p>
  
  <pre><code>void exmaple(char* one, char* two);
  </code></pre>
  
  <p>But was not able to pass the strings from Swift to C++.</p>
  
  <p><strong>Then I changed the function a little:</strong></p>
  
  <pre><code>void example(void* one, void* two)
  {
      string &amp;a = *reinterpret_cast&lt;string*&gt;(one);
      string &amp;b = *reinterpret_cast&lt;string*&gt;(two);
  
      cout&lt;&lt;"String b is: "&lt;&lt;b&lt;&lt;endl;
  }
  </code></pre>
  
  <p><strong>and tried calling the function in Swift:</strong></p>
  
  <pre><code>let aStr = UnsafeMutablePointer&lt;String&gt;.alloc(10)
  aStr.initialize("stringA")
  
  let bStr = UnsafeMutablePointer&lt;String&gt;.alloc(10)
  bStr.initialize("stringB")
  
  example(aStr, bStr)
  </code></pre>
  
  <p>But the only output I get is:</p>
  
  <pre><code>String b is: 
  </code></pre>
  
  <p>How can I pass two Strings from Swift to a C++ function, and then return an array/vector of integers?</p>