title: How to import void * C API into C#?
body: <p>Given this C API declaration how would it be imported to C#?</p>
  
  <pre><code>int _stdcall z4ctyget(CITY_REC *, void *);
  </code></pre>
  
  <p>I've been able to get this far:</p>
  
  <pre><code>   [DllImport(@"zip4_w32.dll",
          CallingConvention = CallingConvention.StdCall,
          EntryPoint = "z4ctygetSTD",
          ExactSpelling = false)]
      private extern static int z4ctygetSTD(ref CITY_REC args, void * ptr);
  </code></pre>
  
  <p>Naturally in C# the "void *" doesn't compile.</p>
  
  <p>Some Googling indicates that it should be translated as "object."  Which seems like it should work.  But others indicate that "Void * is called a function pointer in C/C++ terms which in C# terms is a delegate".  That doesn't make a whole lot of sense here as what would it delegate to?  Some similar calls for other APIs found through Googling use other functions in the respective API.  But in this API no other call would make sense.</p>
  
  <p>The documentation for the call shows an example:</p>
  
  <pre><code>z4ctyget(&amp;city, “00000”);
  </code></pre>
  
  <p>Which seems to show that even a static value could be passed.</p>
  
  <p>It will compile with object in place of the void *.  I don't know whether this is right and I haven't had an opportunity to test it (licensing issue).</p>