473,569 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1901
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.vcp roj) 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.vcp roj) 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
6100
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 file as folows. I need help to resolve them ASAP: cl /c /nologo /MDd /W3 /Od /GR /GM /Zi /GX /D "_DEBUG" /D " WIN32" /D "_W INDOWS" /D "_WINDLL"...
1
2951
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 Visual Studio .net Professional trial version 2003. I have been reading up various documents that discuss - "What is Microsoft .Net" and have...
1
3905
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 make it easier for someone (i.e. a Microsoft person) to digest the information and respond to it. I am a C++ and Java developer with over 3 years of...
99
6045
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 small or mid-sized business. ...
2
2099
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 of posts in the (VB).Net newsgroups and seen just about all of the For and Against arguments i.e. not using it = not coding in VB.NET, not using it =...
182
7421
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
27
5312
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
2460
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 was easy, the thing doesn't work any better. These two instruction lines are not functional 3. Place a Common Dialog control on the form. 4. From...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.