title: Matlab C++ - Receive Dynamic Size Output type (emxArray_real_T)
body: <p>I have converted some matlab code to C++ using coder. </p>
  
  <p><code>void myfunction(const emxArray_real_T *input, emxArray_real_T *output){ ... }</code></p>
  
  <p>I have setup to send <code>emxArray_real_T</code> type inputs without any issues. How do I setup to receive dynamic sized output in C++ which is calling <code>myfunction</code>? </p>
  
  <p>Code updated:</p>
  
  <pre><code>main(){ 
  . 
  . 
  . 
  double *inputVec; 
  inputVec=(double*)malloc(1000 * sizeof(double)); 
  emxArray_real_T *input;
  emxArray_real_T *output;
  
  input=emxCreateWrapper_real_T(&amp;inputVec[0],1,1000); 
  output = emxCreateWrapper_real_T(NULL,0,0);
  
  myfunction(input,output); 
  
  emxDestroyArray_real_T(input);
  emxDestroyArray_real_T(output);
  .
  .
  }
  </code></pre>
  
  <p>This compiles just fine but errors out saying
  <code>*** glibc detected *** /data/myscript : double free or corruption (!prev): 0x000000000de54920 ***</code></p>