On Sat, May 30, 2015 at 10:46 PM, Stefan Behnel <stefan...@behnel.de> wrote: > Jesus-Omar Ocegueda-Gonzalez schrieb am 27.05.2015 um 04:17: >> we recently faced an issue exporting >> inline functions defined in a .pyx. According to this: >> http://docs.cython.org/src/tutorial/pxd_files.html >> the full inline definition (not just the declaration) should be in the pxd. >> However, if we put the definition in the .pyx and just its declaration >> header in the .pxd, Cython declares a pointer to the inline function >> similar to: >> >> static CYTHON_INLINE double (*__function_name)(...); /*proto*/ >> >> but this causes a compilation error in some platforms (but successfully >> compiles in others) because variables cannot be declare as inline. > > Thanks for the report, I agree that this looks like a bug. I'm not entirely > sure what the best fix is. We could make it an error if an external > function declaration in a .pxd file is declared "inline", or we could just > ignore the modifier for external functions on the import side. > > The first case would be more correct, but we'd end up with different > declarations in the .pyx and .pxd files. That might be difficult to explain > to users that run into this problem, as they would first have to understand > that they can still declare their function "inline" in the .pyx file, just > not in the .pxd. Just copying the function header over in order to export > it will make your code fail to compile. > > But the second case might also not be without surprises ("why doesn't my > 'inline' declaration work here?"), and it leaks implementation details into > the .pxd. I'm thus leaning towards the first. I guess it just depends on > coming up with a clear error message. (Well, after detecting this case in > the first place...)
The first also has the disadvantage that one can't create an inline function that is exported as an imported function elsewhere... _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel