Can I embed Windows Python in C# or VC++?

Christian Heimes lists at cheimes.de
Fri Dec 7 06:07:07 EST 2007


sturlamolden wrote:
> The answer is YES. C# can access C functions exported by any DLL with
> platform invoke. Since the Python C API is plain C and not C++ you can
> gain access to it from C#. Import System.Runtime.InteropServices and
> write wrappers like
> 
> [DllImport("Python25.dll"), CallingConvention=CallingConvention.Cdecl]
> public static void Py_Initialize();

There is no need for that. PythonDotNET wraps the P/Invokes and internal
C API of CPython in a nice .NET API.

Christian




More information about the Python-list mailing list