Python and C

Terry Reedy tjreedy at udel.edu
Sat Mar 11 00:27:35 CET 2006


"P Boy" <prettyboy988-google at yahoo.com> wrote in message 
news:1142028064.100012.256170 at v46g2000cwv.googlegroups.com...
> I have recently found another approach by using ctypes
(http://starship.python.net/crew/theller/ctypes/).

Ctypes is now a 2.5 standard lib module and in being tested as such on 
multiple systems.

> I have a library from Microsoft, ewfapi.dll, ewfapi.lib (not required),
and ewfapi.h (from msdn.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),
                ('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),
                ]
?
Would save tedium and errors and make ctypes even more helpful.

Terry Jan Reedy






More information about the Python-list mailing list