Microsoft Visual C++ and pyton

M

mike

Hi,
I am new with python. Is it possible to have an MFC application and
develop some module using python? what are the steps in doing this? can
anybody give me a url or some documentation for this.. thanks..

mike
 
C

Christopher De Vries

I am new with python. Is it possible to have an MFC application and
develop some module using python? what are the steps in doing this? can
anybody give me a url or some documentation for this.. thanks..

It is possible to embed python in a C or C++ application, enabling you to call
python functions from C. I would recommend reading "Extending and Embedding the
Python Interpreter" at http://docs.python.org/ext/ext.html for more
information. If you are currently using Visual C++ 6.0, either stick with
Python 2.3 or read this: http://www.vrplumber.com/programming/mstoolkit/ to
learn how to build extensions for python 2.4 with the free VC++ toolkit
compiler. If you are already using version 7 of the Microsoft C++ compiler then
you should have no problems with Python 2.4.

I usually do not embed the interpreter, but I have written some extension
modules... well, I should say I have used SWIG (http://www.swig.org/) to create
wrappers around some C libraries. For information (read: rants) on extending
versus embedding see http://twistedmatrix.com/users/glyph/rant/extendit.html
and http://c2.com/cgi/wiki?EmbedVsExtend .

You can also use win32 python extensions to make your module available through
COM, but I don't know anything about that.

Chris
 
M

mike

Thanks Chris..
I was also advised to build the python core (pythoncore.vcproj) with my
C++ program. By that way I would not have to load the python core
anymore during runtime. Is this a good approach?
I am currently using VC++ 7 and python 2.4.
- mike
It is possible to embed python in a C or C++ application, enabling you to call
python functions from C. I would recommend reading "Extending and Embedding the
Python Interpreter" at http://docs.python.org/ext/ext.html for more
information. If you are currently using Visual C++ 6.0, either stick with
Python 2.3 or read this:
http://www.vrplumber.com/programming/mstoolkit/ to
 
C

Christopher De Vries

I was also advised to build the python core (pythoncore.vcproj) with my
C++ program. By that way I would not have to load the python core
anymore during runtime. Is this a good approach?
I am currently using VC++ 7 and python 2.4.

I'm not sure... I'm not very familiar with PC builds.

Chris
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top