title: How to pass an array of array of floats to C++ function from swift
body: <p>I have a C++ function declared in <code>Bridging-Header.h</code></p>
  
  <pre><code>struct MyFloat3{
      float x;
      float y;
      float z;
  };
  struct MyFloat3 ExtCurl(const float** triangle);
  </code></pre>
  
  <p>I have followed the instructions at <a href="http://www.swiftprogrammer.info/swift_call_cpp.html" rel="nofollow noreferrer">http://www.swiftprogrammer.info/swift_call_cpp.html</a>
  wrapper.cpp</p>
  
  <pre><code>#include "Curl.h"
  extern "C" MyFloat3 ExtCurl(const float** triangle){
      return Curl(triangle);
  }
  </code></pre>
  
  <p>Curl.h</p>
  
  <pre><code>struct MyFloat3{
      float x;
      float y;
      float z;
  };
  MyFloat3 Curl(const float** triangle);
  </code></pre>
  
  <p>Curl.cpp</p>
  
  <pre><code>#include "Curl.h"
  MyFloat3 Curl(const float** triangle){
    MyFloat3 curl;
    curl.x = (triangle[1][1] - triangle[0][1])*(triangle[2][2]-triangle[0][2]) - (triangle[1][2] - triangle[0][2])*(triangle[2][1]-triangle[0][1]);
    curl.y = (triangle[1][2] - triangle[0][2])*(triangle[2][0]-triangle[0][0]) - (triangle[1][0] - triangle[0][0])*(triangle[2][2]-triangle[0][2]);
    curl.z = (triangle[1][0] - triangle[0][0])*(triangle[2][1]-triangle[0][1]) - (triangle[1][1] - triangle[0][1])*(triangle[2][0]-triangle[0][0]);
    return curl;
  }
  </code></pre>
  
  <p>I tried to call it from my swift code</p>
  
  <pre><code>var triangle:[[Float]] = [
              [1.0, 0.0, 0.8],
              [0.0, 0.5, 0.0],
              [4.0, 0.0, 6.0]
          ]
  var normal:MyFloat3
  normal = ExtCurl(triangle)
  </code></pre>
  
  <p>Compiler scolds </p>
  
  <pre><code>Node.swift:127:38: Cannot convert value of type '[[Float]]' to
  expected argument type 'UnsafeMutablePointer&lt;UnsafePointer&lt;Float&gt;?&gt;!'
  </code></pre>
  
  <p>An another function of my C++ library which returns void but fills an array through the pointer given to it is working fine</p>