python application dll

D

dongarbage

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
 
G

Gabriel Genellina

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
 
L

Larry Bates

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
 
D

dongarbage

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

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#?
 
D

dongarbage

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"?
 
C

Chris Mellon

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top