title: How do I deal with a pointer when Swift calls C API
body: <p>The c Lib API :  mycapi.h</p>
  
  <pre><code>typedef struct{
      int  itype;
      double * dx;
      double * dy;
  }MyObjInfo;
  
  typedef MyObjInfo * MyObjHandle；
  
  MyObjHandle MyObjInit(const char *pFile);
  </code></pre>
  
  <p>add myapi.h as module</p>
  
  <p>my swift code :</p>
  
  <pre><code>import Foundation
  import mycapiModule
  
  
  var h:MyObjHandle = MyObjInit("/home/a")
  var o:MyObjInfo = h.memory
  ////to do somethings
  //...
  h.destroy()
  h = nil
  print("\(o.itype)")
  </code></pre>
  
  <p><strong>So my questions are:</strong></p>
  
  <ol>
  <li>Why am I still able to use <code>o</code>  after <code>h.destroy()</code>?</li>
  <li>Do I have to destroy <code>h</code> and <code>o</code>?</li>
  </ol>