porting vc++ project to python?

M

marco Starglider

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?
 
M

Matt McCredie

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
 
S

Steve Holden

marco said:
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 -------------
 
D

Diez B. Roggisch

marco said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top