Hello to all I've start to use cython in order to use call some API modules written in python from C/C++. Those modules written in python must remain untouched, and all .py files should be "decorated" with their counterpart .pxd files. I would like to mark as public some API functions from .py files, following the indications from http://docs.cython.org/src/tutorial/pxd_files.html. I've started to write a little example:
suma_alex.py: def suma_Alex(a,b): return a+b suma_alex.pxd: cdef public int suma_Alex(int a,int b) The combination of those two files should turn into something like this for the compiler: cdef public int suma_Alex(int a,int b): return a+b On generated .h file I should obtain a function prototype like this: __PYX_EXTERN_C DL_IMPORT(int) suma_Alex(int, int); Instead of that, I obtain a prototype like this: __PYX_EXTERN_C DL_IMPORT(int) __pyx_f_10suma_alex_suma_Alex(int, int); Digging into code and executing cythonize with pdb, I followed that is executed a pipeline for .py file before .pxd file's pipeline. Correct me if I'm wrong, but this makes the name of .c function be generated according to py file instead of pxd file. That makes an add of string "__pyx_f_10suma_alex_" before function name, because the compiler doesn't know about "public" key (on python doesn't exists). Including public key on a pxd file for this function makes the compiler remove "static" key and generate a .h file, but doesn't change the name prototype into a simple "suma_Alex". If I use cython on a pyx file containing the code below, it works perfectly as expected. cdef public int suma_Alex(int a,int b): return a+b The questions are: - I'm doing what I want to do on a right way? - Is this feature included on cython development version? I've tried on 0.20.2 - If is not implemented, I want to colaborate implementing it. Could you please provide me some guidelines with the methods/modules that I should modify? King regards, Alexandru. -- *---------------------------------------------------------------Alexandru Ionut Grama**email: gramaalexandruio...@gmail.com <gramaalexandruio...@gmail.com>*
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel