Sebastian Pinet wrote:
> how would this translate into the pure-python mode ? (I couldn't seem to
> be
> able to declare the C-sqrt function using the pure-python mode of cython:
> http://wiki.cython.org/pure wasn't helpful)

You can't. Calling C functions directly is a fundamental consequence of
compiling with Cython and even if there was a pure-python syntax for it
your code couldn't run in pure Python.

What one could do (but which noone has attempted yet) is to make the
Cython "shadow module" (which is used when running the code in pure
Python) simply wrap ctypes, so that ctypes is used when not compiling and
Cython is used when compiling. The hardest part here is actually writing
the shadow module (Cython/Shadow.py) so that one can make Cython
declarations and have them translated to ctypes declarations.

(This would require to have some calls like

cython.loadlibrary(...)

which would just be ignored in Cython.)

Dag Sverre

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

Reply via email to