Microsoft Visual C++ and pyton

Discussion in 'Python' started by mike, Jan 30, 2005.

  1. mike

    mike Guest

    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
    mike, Jan 30, 2005
    #1
    1. Advertising

  2. 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
    Christopher De Vries, Jan 31, 2005
    #2
    1. Advertising

  3. mike

    mike Guest

    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
    mike, Jan 31, 2005
    #3
  4. 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
    Christopher De Vries, Feb 1, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen VanDahm

    Securing the Pyton Interpreter?

    Stephen VanDahm, Jul 15, 2003, in forum: Python
    Replies:
    6
    Views:
    360
    Vinoo Vasudevan
    Jul 17, 2003
  2. Steffen Kunze
    Replies:
    2
    Views:
    393
    Steffen Kunze
    Jul 28, 2004
  3. Philippe C. Martin

    parsing pyton code

    Philippe C. Martin, Nov 6, 2004, in forum: Python
    Replies:
    1
    Views:
    344
    Jean Brouwers
    Nov 6, 2004
  4. Mark de+la+Fuente

    Is pyton for me?

    Mark de+la+Fuente, Jun 10, 2005, in forum: Python
    Replies:
    11
    Views:
    760
    Mike Meyer
    Jun 11, 2005
  5. Daniel Nogradi
    Replies:
    0
    Views:
    410
    Daniel Nogradi
    May 4, 2006
Loading...

Share This Page