By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,095 Members | 1,658 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,095 IT Pros & Developers. It's quick & easy.

python application dll

P: n/a
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 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
En Sat, 17 Nov 2007 12:04:49 -0300, <do********@hotmail.comescribi´┐Ż:
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

Nov 19 '07 #2

P: n/a
do********@hotmail.com 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
Nov 19 '07 #3

P: n/a
On Nov 19, 2:28┬*am, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:
En Sat, 17 Nov 2007 12:04:49 -0300, <dongarb...@hotmail.comescribi´┐Ż:
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 '07 #4

P: n/a
On Nov 19, 3:49 pm, Larry Bates <larry.ba...@websafe.comwrote:
dongarb...@hotmail.com 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 '07 #5

P: n/a
On Nov 20, 2007 8:12 AM, <do********@hotmail.comwrote:
On Nov 19, 3:49 pm, Larry Bates <larry.ba...@websafe.comwrote:
dongarb...@hotmail.com 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.
Nov 20 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.