from ctypes import *
dll = CDLL('x')


class Foo(Structure):
    _fields_ = [('id', c_uint), ('name', c_char * 256)]
pfoo = POINTER(Foo)()
count = dll.func(byref(pfoo))
for i in range(count):
    pass
Python calling C Shared Library with ctypes custom structures