Python程序处理如下:
from ctypes import *class StructPointer(Structure):passStructPointer._fields_=[('x', c_int),('y', c_int),('next', POINTER(StructPointer))]lib = cdll.LoadLibrary('./StructPointer.so')lib.test.restype = POINTER(StructPointer)p = lib.test()print p.contents.x
关于resttype可以参见 Tutorial :By default functions are assumed to return the Cinttype.Other return types can be specified by setting therestypeattributeof the function object.