Microsoft Visual C++ and pyton

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike

    #1

    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

  • Christopher De Vries

    #2
    Re: Microsoft Visual C++ and pyton

    On Sun, Jan 30, 2005 at 03:12:06PM -0800, mike wrote:[color=blue]
    > 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..[/color]

    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

    Comment

    • mike

      #3
      Re: Microsoft Visual C++ and pyton

      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:[color=blue]
      > On Sun, Jan 30, 2005 at 03:12:06PM -0800, mike wrote:[color=green]
      > > I am new with python. Is it possible to have an MFC application[/color][/color]
      and[color=blue][color=green]
      > > develop some module using python? what are the steps in doing this?[/color][/color]
      can[color=blue][color=green]
      > > anybody give me a url or some documentation for this.. thanks..[/color]
      >
      > It is possible to embed python in a C or C++ application, enabling[/color]
      you to call[color=blue]
      > python functions from C. I would recommend reading "Extending and[/color]
      Embedding the[color=blue]
      > Python Interpreter" at http://docs.python.org/ext/ext.html for more
      > information. If you are currently using Visual C++ 6.0, either stick[/color]
      with[color=blue]
      > Python 2.3 or read this:[/color]
      http://www.vrplumber.com/programming/mstoolkit/ to[color=blue]
      > learn how to build extensions for python 2.4 with the free VC++[/color]
      toolkit[color=blue]
      > compiler. If you are already using version 7 of the Microsoft C++[/color]
      compiler then[color=blue]
      > you should have no problems with Python 2.4.
      >
      > I usually do not embed the interpreter, but I have written some[/color]
      extension[color=blue]
      > modules... well, I should say I have used SWIG (http://www.swig.org/)[/color]
      to create[color=blue]
      > wrappers around some C libraries. For information (read: rants) on[/color]
      extending[color=blue]
      > versus embedding see[/color]
      http://twistedmatrix.com/users/glyph/rant/extendit.html[color=blue]
      > and http://c2.com/cgi/wiki?EmbedVsExtend .
      >
      > You can also use win32 python extensions to make your module[/color]
      available through[color=blue]
      > COM, but I don't know anything about that.
      >
      > Chris[/color]

      Comment

      • Christopher De Vries

        #4
        Re: Microsoft Visual C++ and pyton

        On Mon, Jan 31, 2005 at 02:42:11PM -0800, mike wrote:[color=blue]
        > 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.[/color]

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

        Chris

        Comment

        Working...