[IronPython] Announcement: Project to get some CPython C extensions running under IronPython

Paolo Molaro lupus at ximian.com
Wed Oct 17 19:02:05 CEST 2007


On 10/17/07 Curt Hagenlocher wrote:
> On 10/17/07, Paolo Molaro <lupus at ximian.com> wrote:
> > The python API requires a couple dozen structure definitions plus a few
> > dozen dllimport declarations. This can be about 200 lines of trivial
> > to write declarative stuff.
> 
> I'm having trouble understanding what you mean by this.  Let's say I've got
> an extension method that looks like this:
> 
> PyObject * ModifyColumns(PyObject * self, PyObject * args)
> {
[...]
> In order to use this extension from IronPython, I need C implementations of
> each of those API functions.  The PySequence_ methods should to be able to
> understand CLR arrays or any other IEnumerable-like object.  I'm not sure
> what PyTuple_New should return, but whatever it is will need to have
> PyObject*-like semantics.
> 
> How does DllImport fit into this picture?  How can I avoid implementing all
> these functions in C or C++?

You do need to write C code as the API is a C API. I didn't list in the
last mail because the C implementation of these functions is not a
difference between the C# impl and the C++ impl of the rest of the code.
The dllimport declarations I mentioned above would pinvoke to these C
functions.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Ironpython-users mailing list