[Cython] Proposal: extern implementations of functions
Jeroen Demeyer
jdemeyer at cage.ugent.be
Sat Mar 7 09:58:06 CET 2015
Hello Cython developers,
I would like to propose a new mechanism to implement functions in an
external .c file. The goal is to solve the problem I was having in
https://groups.google.com/forum/#!topic/cython-users/TsbBNyvwZn4
With the attached patch, you can do the following:
* in foo.pxd, declare the function as usual:
cdef void myfunc()
* in foo.c, actually implement the function:
static void myfunc()
{
/* ... */
}
* in foo.pyx, declare the function extern:
cdef extern from "foo.c":
void myfunc()
With my patch, the extern declaration in foo.pyx will be interpreted as
implementing the function. Therefore, myfunc() is now available in the
module foo, and it can also be cimported by other modules.
What do you think of this proposed feature?
Jeroen.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extern_implementation.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20150307/2885792f/attachment.bin>
More information about the cython-devel
mailing list