title: How to send python dict to C++
body: <ul>
  <li>This is my python function:</li>
  </ul>
  <pre><code>if __name__ == &quot;__main__&quot;:
      file = open(&quot;data_input.txt&quot;, &quot;r&quot;)
      contents = file.read()
      e = ast.literal_eval(contents)
      neighbour_num= 4
      new_data = 300
      result = np.ndarray((4,4),dtype='int32',buffer=np.zeros((4,4),dtype='int32'))
      c_module.mmult_wrapper(e, new_data, neighbour_num, result)
  </code></pre>
  <ul>
  <li>This is my C++ function, where i want to use dict as array</li>
  </ul>
  <pre><code>   void mmult(double new_data, double neighbour_num, double e[100], int32_t result[16]) {
     double distances[100];
     unsigned distances_front = 0;
     unsigned distances_back = 0;
  
     double keys[100];
     unsigned keys_front = 0;
     unsigned keys_back = 0;
   
  
     for(int i=0;i&lt;(int)100; i=i+1) {
  
        double temp_distance=(new_data-e[i]);
  
        double sq_tmp=(temp_distance*temp_distance);
  
        double sqrt=(sq_tmp/2);
  
        double temp=0;
        while(sqrt!=temp) {
           temp = sqrt;
           sqrt = (((sq_tmp/temp)+temp)/2);
        }
        distances[distances_front++] = (sqrt);
        keys[keys_front++] = (e[i-1]);
     }
     for(int i=0; i&lt;(int)(keys_front - keys_back); i=i+1) {
        for(int j=(i+1); j&lt;(int)(distances_front - distances_back); j=j+1) {
           if(distances[i]&gt;distances[j]) {
              distances[i] = distances[j];
              distances[j] = distances[i];
              keys[i] = keys[j];
              keys[j] = keys[i];
           }
        }
     }
     for(int i=0; i&lt;(int)neighbour_num; i=i+1) {
        result[i] = keys[i];
     }
  } 
  </code></pre>
  <ul>
  <li>this is the wrapper function i have</li>
  </ul>
  <pre><code>#include &lt;Python.h&gt;
  #include &lt;numpy/arrayobject.h&gt;
  #include &quot;spyc.h&quot;
  #include &quot;caller.h&quot;
  
  static PyObject* mmult_wrapper(PyObject* self, PyObject* args) {
  
     int32_t e;
     int32_t new_data;
     int32_t neighbour_num;
     int32_t result;
  
     int res = PyArg_ParseTuple(args, &quot;Oi&quot;, &amp;e_obj, &amp;d);
  
     if (!res)
        return NULL;
  
  
     /* call function */
     mmult_caller(e,d);
  
  } 
  
  </code></pre>
  <ul>
  <li>My objective to accept the dict values from python function and convert it to array values suitable for C in the wrapper. I have no prior knowledge of C\C++ and i am stuck. Any help will be greatly helpful. thanks</li>
  </ul>