title: How to return a pointer to a structure in ctypes?
body: <p>I try to pass a pointer of a structure which is given me as a return value from the function 'bar' to the function 'foo_write'. But I get the error message 'TypeError: must be a ctypes type' for line 'foo = POINTER(temp_foo)'. In the <a href="http://docs.python.org/library/ctypes.html" rel="noreferrer">ctypes online help</a> I found that 'ctypes.POINTER' only works with ctypes types. Do you know of another way? What would you recommend?</p>
  
  <p>C:</p>
  
  <pre><code>typedef struct FOO_{
      int i;
      float *b1;
      float (*w1)[];
  }FOO;
  
  foo *bar(int foo_parameter) {...
  void foo_write(FOO *foo)
  </code></pre>
  
  <p>Python with ctypes:</p>
  
  <pre><code>class foo(Structure):
      _fields_=[("i",c_int),
                ("b1",POINTER(c_int)),
                ("w1",POINTER(c_float))]
  
  temp_foo=foo(0,None,None)
  foo = POINTER(temp_foo)
  foo=myclib.bar(foo_parameter)
  myclib.foo_write(foo)
  </code></pre>