python application dll

Discussion in 'Python' started by dongarbage@hotmail.com, Nov 17, 2007.

  1. Guest

    Hi,

    Is there a way to create a .dll from a python program which includes
    the python runtime?

    I'm building a Windows application (C# VisualStudio2005) and I'd like
    to utilize some of the functionality available in a Python module. For
    my users who install my Windows application, I'd prefer that they not
    have to install the entirety of Python on their machines.

    Thanks much,
    D
     
    , Nov 17, 2007
    #1
    1. Advertising

  2. En Sat, 17 Nov 2007 12:04:49 -0300, <> escribi�:

    > Is there a way to create a .dll from a python program which includes
    > the python runtime?
    >
    > I'm building a Windows application (C# VisualStudio2005) and I'd like
    > to utilize some of the functionality available in a Python module. For
    > my users who install my Windows application, I'd prefer that they not
    > have to install the entirety of Python on their machines.


    I think that linking Python directly with C# isn't easy; Python + C++ OTOH
    is a lot easier.
    Another approach is to have a Python *application* (.exe) running; you may
    communicate the two with virtually any available IPC mechanism. You can
    use py2exe to generate the .exe

    --
    Gabriel Genellina
     
    Gabriel Genellina, Nov 19, 2007
    #2
    1. Advertising

  3. Larry Bates Guest

    wrote:
    > Hi,
    >
    > Is there a way to create a .dll from a python program which includes
    > the python runtime?
    >
    > I'm building a Windows application (C# VisualStudio2005) and I'd like
    > to utilize some of the functionality available in a Python module. For
    > my users who install my Windows application, I'd prefer that they not
    > have to install the entirety of Python on their machines.
    >
    > Thanks much,
    > D


    Turn the Python program into a COM object instead. Then it can be dispatched by
    any programming language and distributed after bundling with py2exe.

    -Larry
     
    Larry Bates, Nov 19, 2007
    #3
  4. Guest

    On Nov 19, 2:28 am, "Gabriel Genellina" <>
    wrote:
    > En Sat, 17 Nov 2007 12:04:49 -0300, <> escribi�:
    >
    > > Is there a way to create a .dll from a python program which includes
    > > the python runtime?

    >
    > > I'm building a Windows application (C# VisualStudio2005) and I'd like
    > > to utilize some of the functionality available in a Python module. For
    > > my users who install my Windows application, I'd prefer that they not
    > > have to install the entirety of Python on their machines.

    >
    > I think that linking Python directly with C# isn't easy; Python + C++ OTOH  
    > is a lot easier.
    > Another approach is to have a Python *application* (.exe) running; you may  
    > communicate the two with virtually any available IPC mechanism. You can  
    > use py2exe to generate the .exe
    >
    > --
    > Gabriel Genellina


    How do you linke Python directly with C++? This could be a
    consideration for me if it is possible to call a C++-based dll from
    C#. That leads to my next question which might not be appropriate for
    a python newsgroup, but what the heck: Is it possible to call a C++-
    based dll from C#?
     
    , Nov 20, 2007
    #4
  5. Guest

    On Nov 19, 3:49 pm, Larry Bates <> wrote:
    > wrote:
    > > Hi,

    >
    > > Is there a way to create a .dll from a python program which includes
    > > the python runtime?

    >
    > > I'm building a Windows application (C# VisualStudio2005) and I'd like
    > > to utilize some of the functionality available in a Python module. For
    > > my users who install my Windows application, I'd prefer that they not
    > > have to install the entirety of Python on their machines.

    >
    > > Thanks much,
    > > D

    >
    > Turn the Python program into a COM object instead. Then it can be dispatched by
    > any programming language and distributed after bundling with py2exe.
    >
    > -Larry


    OK, I'm a newbie and not sure how to create/call COM objects. This is
    probably not a question for a python newsgroup, but what the heck: How
    do you turn a python program into a COM object? And, what does it mean
    to be "dispatched"?
     
    , Nov 20, 2007
    #5
  6. Chris Mellon Guest

    On Nov 20, 2007 8:12 AM, <> wrote:
    > On Nov 19, 3:49 pm, Larry Bates <> wrote:
    >
    > > wrote:
    > > > Hi,

    > >
    > > > Is there a way to create a .dll from a python program which includes
    > > > the python runtime?

    > >
    > > > I'm building a Windows application (C# VisualStudio2005) and I'd like
    > > > to utilize some of the functionality available in a Python module. For
    > > > my users who install my Windows application, I'd prefer that they not
    > > > have to install the entirety of Python on their machines.

    > >
    > > > Thanks much,
    > > > D

    > >
    > > Turn the Python program into a COM object instead. Then it can be dispatched by
    > > any programming language and distributed after bundling with py2exe.
    > >
    > > -Larry

    >
    > OK, I'm a newbie and not sure how to create/call COM objects. This is
    > probably not a question for a python newsgroup, but what the heck: How
    > do you turn a python program into a COM object? And, what does it mean
    > to be "dispatched"?
    >


    You're getting in far above your head - these are advanced concepts
    and require a fairly detailed low level knowledge of .NET, Python, and
    COM.

    Firstly, you should be aware that doing this will still require your
    users to "install all of Python" on their machine, or at least a large
    subset, because you'll need a good portion of the standard library to
    do anything useful.

    You should look at the python for .NET project and IronPython,
    depending on your needs.

    Python for .NET is a .NET <-> CPython bridge, which will allow you to
    create and drive a CPython interpreter from .NET. This instance of
    Python will be able to use regular CPython extension modules, as well
    as (through the bridge) call back up into .NET code. It requires a
    working CPython installation.

    IronPython is a pure .NET implementation of Python, and will allow you
    have a Python interpreter that can load .NET assemblies, but it won't
    be able to load Python C modules. It requires installation like all
    ..NET libraries do, but no CPython installation - it's a separate
    implementation of Python.
     
    Chris Mellon, Nov 20, 2007
    #6
    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. Anushi
    Replies:
    5
    Views:
    8,788
  2. Krzysiek
    Replies:
    2
    Views:
    528
    Krzysiek
    Jul 5, 2004
  3. Replies:
    2
    Views:
    521
    Larry Bates
    Mar 9, 2007
  4. Paul
    Replies:
    1
    Views:
    133
    joker
    Aug 18, 2004
  5. H. Simpson
    Replies:
    4
    Views:
    289
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page