Python and C

Terry Reedy tjreedy at udel.edu
Sat Mar 11 00:59:39 EST 2006


"P Boy" <prettyboy988-google at yahoo.com> wrote in message 
news:1142047621.068618.176350 at j52g2000cwj.googlegroups.com...
>> 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),
etc
>
> 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.

Or vc6.  Neither of which most people have, especially those not using Swig 
because they don't do C.  Ok, we need program entirely in Python.  Possible 
exercise for someone.

> My header file is relatively small. The manual translation exercise
> also allowed me to understand more details about ctypes.

Sure, the first time I would do such also.

tjr






More information about the Python-list mailing list