title: Pass an Objective-C object to a function as a void * pointer
body: <p>I have a function:</p>
  
  <pre><code>  myFunction (MyProc callback, void * ref)
  </code></pre>
  
  <p>This function is called from within an Objective-C class. The function is passed a pointer to the callback (a function in the class) and a reference. The reference is necessary because the callback is called statically and therefore doesn't have a context. The ref can be used to provide a context to the callback. </p>
  
  <p>I want to be able to pass the Objective-C class as the reference. So the question is:</p>
  
  <p>How do I cast an NSObject to a void * and how do I cast a void * as an NSObject.</p>
  
  <p>Thanks in advance.</p>