title: Convert intptr to ulong array
body: <p>I am calling a method from C# like this:</p>
  
  <pre><code>[DllImport(@"pHash.dll", CallingConvention = CallingConvention.Cdecl)]
  public static extern IntPtr ph_dct_videohash(string file, ref int length);
  </code></pre>
  
  <p>And here is the method I am calling from the library</p>
  
  <pre><code>ulong64* ph_dct_videohash(const char *filename, int &amp;Length){
  
      CImgList&lt;uint8_t&gt; *keyframes = ph_getKeyFramesFromVideo(filename);
      if (keyframes == NULL)
          return NULL;
  
      Length = keyframes-&gt;size();
  
      ulong64 *hash = (ulong64*)malloc(sizeof(ulong64)*Length);
      //some code to fill the hash array
      return hash;
  }
  </code></pre>
  
  <p>How can I read the <code>ulong</code> array from the <code>IntPtr</code>?</p>