471,310 Members | 1,385 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

porting vc++ project to python?

hi,

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.

regards,

m

ps i guess, it's an option to transform my current code into one or more
python extensions/modules, and then calling them from a python core
module?
Aug 22 '07 #1
3 1179
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
Aug 22 '07 #2
marco Starglider wrote:
hi,

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.

regards,

m

ps i guess, it's an option to transform my current code into one or more
python extensions/modules, and then calling them from a python core
module?

Clients of mine have had very good results wrapping C++ functionality
with Boost (http://www.boost.org/libs/python/doc/). It might work for
you too.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

Aug 23 '07 #3
marco Starglider schrieb:
hi,

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.

regards,

m

ps i guess, it's an option to transform my current code into one or more
python extensions/modules, and then calling them from a python core
module?
It is. I personally prefer SIP, which is a C++ wrapper generator used to
wrap the Qt toolkit. But there are other options as well, e.g. SWIG and
Boost::Python.

Diez
Aug 23 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Wolfgang Keller | last post: by
1 post views Thread by Robin Charisse | last post: by
5 posts views Thread by Pardeep Singh | last post: by
2 posts views Thread by sandip desale | last post: by
6 posts views Thread by =?Utf-8?B?RGlwZXNoX1NoYXJtYQ==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.