On 7 Des, 08:07, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:

> > Does it mean, I can embed Python in C# as well with the same APIs?
>
> No; you can use the Python API in a native C++ application (the Python
> code is plain C, but all the include files have the 'extern "C" {}'
> declarations). For .NET there are IronPython and PythonNet, but I cannot
> comment on them, surely someone else may help. See  
> http://www.python.org/about/

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();

etc.


You can also combine C++ and C# in a project in MS Visual Studio, if
you prefer to access Python from C++. That way you don't have to write
platform invoke wrappers for the Python C API.




-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to