Using C++ and ctypes together: a vast conspiracy? ;)

Thomas Heller theller at
Fri Jun 5 17:33:01 CEST 2009

Philip Semanchuk schrieb:
> On Jun 5, 2009, at 10:13 AM, Thomas Heller wrote:
>> skip at schrieb:
>>>>> If there is no C++ compiler available then the proposed layout  
>>>>> sniffing just
>>> wouldn't be done and either a configure error would be emitted or a  
>>> run-time
>>> exception raised if a program attempted to use that feature.  (Or the
>>> sniffing could be explicitly enabled/disabled by a configure flag.)
>> Hm, on Linux, gccxml (if its version is compatible with that of the C 
>> ++ compiler)
>> can probably help a lot.  At runtime, no configure step needed.
>> Unfortunately not on Windows.
> I'm not a gccxml user, but its install page has a section for Windows:

Yes, it runs on Windows (*).  However, there are two problems:

1. gccxml refuses to parse quite some include files from the Window SDK.
That's probably not the fault of gccxml but MS using non-standard C++
constructs.  (There is a workaround inside gccxml: it installs patched
Windows header files, but the patches must be created first by someone)

2. You cannot expect gccxml (which is mostly GCC inside) to use the MSVC
algorithm for C++ object layout, so unfortuately it does not help in the
most important use-case.


(*) And there is even use for it on Windows to parse C header files and
generate ctypes wrappers, in the ctypeslib project.

More information about the Python-list mailing list