porting vc++ project to python?

Matt McCredie mccredie at gmail.com
Wed Aug 22 13:52:47 EDT 2007


> i have a very large project in visual studio2005->visual c++ in windowsxp.
> i'd like to port it, or my next project,  over to python.
> is this possible without rewriting all my code?
> are there multiple options to do this?
> my project is so large, that entirely rewriting it
> is actually no option.

You have a couple of options, but it really depends on the structure
of your program.

Option 1: You could encapsulate the important portions of your code in
DLLs and access them from python using the ctypes module.

Option 1b: You could encapsulate the important portions of your code
as COM DLLs and access them from win32com.

Option 2: You could turn your code into python extensions (DLL):
http://docs.python.org/ext/

Option 3: You could rewrite portions of your code in python and access
it from VC++: same as before - http://docs.python.org/ext/

It all depends on how your project is structured, and what you
consider to be the most difficult part to convert. If your app has a
complex user interface and that is the most difficult part to convert
then option 3 is probably best. If the code is well encapsulated and
the user interface will be easy to rewrite then options 1 or 2 will
work best. It is probably best to stay away from 1b unless portions of
your stuff already exist as COM DLLs. If you do have COM DLLs however,
accessing them from Python is very easy.

Matt



More information about the Python-list mailing list