[python-win32] Second DLL question
Tim Roberts
timr at probo.com
Fri Jan 13 19:19:27 CET 2012
Jacob Kruger wrote:
> How easy/simple is it to actually compile python code into a DLL to be
> used on windows by other programming languages, etc.?
>
> I can easily enough use py2exe to generate command line apps that can
> be called using command line arguments, etc., but was just wondering
> (as well).
With caveats, that is generally not possible. The Python implementation
you're used is interpreted. To run Python code, you have to run an
interpreter. It is possible for a program to create an instance of the
interpreter and pass that instance some code, but there's no way to
package that up so the caller doesn't know it's Python.
Now, you can certainly create COM servers in Python that can be invoked
from other non-Python programs. There are many, many examples of that.
Also, I believe IronPython will let you do this. That's the .NET
implementation of Python.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list