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



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

.



Relevant Pages

  • Re: Accessors in Python (getters and setters)
    ... used it in 27000 lines of Python code (which certainly took some time to ... Naming attributes and naming methods are entirely different ... operator only to callables, but this doesn't make such a difference ... But it's *your* responsability to choose good names for the API.> ...
    (comp.lang.python)
  • Re: zlib interface semi-broken
    ... implement one-shot de/compression of strings. ... functions that do one-shot compression and decompression. ... That file interface could form a third API, ... conform to what python expects of files. ...
    (comp.lang.python)
  • Re: Accessors in Python (getters and setters)
    ... used it in 27000 lines of Python code (which certainly took some time to ... develops might misinterpret exactly what "tmp" does. ... Failing to understand a language semantics ... But it's *your* responsability to choose good names for the API.> ...
    (comp.lang.python)
  • Re: Whats so funny? WAS Re: rotor replacement
    ... I don't disagree about the API. ... AES module (or rather, a generic block cipher module with AES and DES) ... if I want ECC in a Python ...
    (comp.lang.python)
  • Re: OpenGL
    ... It was originally written in pure Python C-extension code, then Tarn rewrote it using SWIG a few years ago. ... OpenGL-ctypes is in the PyOpenGL CVS repository, it's a ctypes re-re-implementation of the same Python API to OpenGL. ... Basically any array type can be registered with handlers that let you tell the system how to do basic operations; get an array's size, shape, data-type, convert to a given data-format, build an "empty" array of a given size, that kind of thing. ...
    (comp.lang.python)