Hi Darren,

> Hello,
>
> I am just learning cython, please bear with me. This is maybe a common
> question, but I didn't recognize it in the documentation or the FAQs.
> How do you make cython definitions available to external C code? For
> example, converting some of numpy's code in numpy/core/src/multiarray
> to cython without affecting the C API?

Doing just this is something I've been eager to try myself, please don't
hesitate to ask any questions you might have in the process.

I hope it's OK that I write down some thoughts I have about this, even if
they're not really related to your question.

One thing that complicates this process is that NumPy has a requirement
that both modes of building the multiarray module works:
- Building all C files seperately, then linking
  -- But this won't work with Cython out of the box because the module
initialization code won't get called, so that globals etc. are not
initialized properly.
- Including all C files in a single master C file, then compile only that
one file
  -- This won't work with Cython as it inserts module initialization code
which will conflict with the module initialization code already present
in multiarray.

What I've thought about though is starting with module initialization
code, i.e. rewrite NumPy's module initialization code in Cython as the
first thing. This might solve both modes above (with some more hacks, no
doubt). Module initialization is a major hurdle with regards to Python 3
anyway, so it's as good a place to start as any.

Dag Sverre

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to