473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Microsoft Visual C++ and pyton

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

Jul 18 '05 #1
3 1874
On Sun, Jan 30, 2005 at 03:12:06PM -0800, mike wrote:
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
Jul 18 '05 #2
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

Christopher De Vries wrote:
On Sun, Jan 30, 2005 at 03:12:06PM -0800, mike wrote:
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


Jul 18 '05 #3
On Mon, Jan 31, 2005 at 02:42:11PM -0800, mike wrote:
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
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
1
by: Novice | last post by:
Hi all, I am a C++ and Java developer with over 3 years of industry experience. I've written low level C++ code, in addition to web clients that use web services. I've just recently installed the...
1
by: Novice | last post by:
Hi all, I'm afraid this is the second posting of this information as I didn't get a response on the previous post. I will try to shorten my message (i.e. be more concise) in the hopes that it will...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
2
by: Steve | last post by:
Having only recently migrated across from VB6 to VB.NET I'm still unsure whether or not I should be making (heavy) use of the Microsoft.VisualBasic namespace in new applications. I've read a lot...
182
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
27
by: psbasha | last post by:
Hi, I want to create a Exe of an Pyton Aplication in Windows and UNIX.For example,Ihave the following ".py"files Sample1.py Sample2.py Sample3.py ................ Samplen.py Main.py
23
by: =?Utf-8?B?TWlrZTE5NDI=?= | last post by:
This is an example that is supposed to work in VB http://support.microsoft.com/kb/175512/en-us After spending a couple of hours downloading and installing VB Express 2008 after someone told me it...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.