> Has anyone yet written a program to grab C struct declaration from the .h > to produce code like > > # Overlay configuration > class OverlayStoreConfig(ctypes.Structure): > _fields_ = [('FormatVersion', ctypes.c_ulong), > ('VolumeSize', ctypes.c_longlong), > ('NumSegments', ctypes.c_ulong), > ('FreeSegments', ctypes.c_ulong), > ('SegmentSize', ctypes.c_ulong), > ('MaxVolumes', ctypes.c_ulong), > ('NumVolumes', ctypes.c_ulong), > ('MaxLevels', ctypes.c_ushort), > ('VolumeDescArray', pVolumeDesc), > ] > ?
http://starship.python.net/crew/theller/ctypes/codegen.html says it can be done. However, it requires MSVC 7.1 and I have not yet install it since I already have MSVC (6,7,8) on my PC. My header file is relatively small. The manual translation exercise also allowed me to understand more details about ctypes. -- http://mail.python.org/mailman/listinfo/python-list