title: Converting Python instance to ctypes.c_void_p
body: <p>I'm trying to convert a Python object into C void pointer so that it would be callable from C API's, however the following code doesn't seem to work
  from ctypes import *</p>
  
  <pre><code>class myclass:
      def __init__(self):
          self.val = 6
          return
  
  
  foo = myclass()
  
  data = c_void_p(foo)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 26, in &lt;module&gt;
      data = c_void_p(foo)
  TypeError: cannot be converted to pointer
  </code></pre>
  
  <p>I've also tried pointer() and byref(), but none of them works. How can I achieve what I'm trying to do? Thanks in advance.</p>