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

Thomas Heller theller at python.net
Thu Jun 4 04:43:57 EDT 2009


Joseph Garvin schrieb:
> So I was curious whether it's possible to use the ctypes module with
> C++ and if so how difficult it is.

There have been some attempts to use ctypes to access C++ objects.
We (Roman Yakovenko and myself) made some progress.  We were able to
handle C++ name mangling, the special C++ calling convention,
access virtual, non-virtual, overloaded functions, but finally gave up
because the binary layout (function tables, member variables, and so on)
of C++ objects is way too complicated and undocumented.

Our attempts are documented in posts to the ctypes-users mailing list,
most of them have the word 'cpptypes' in the subject line.

Thomas



More information about the Python-list mailing list