|Bill Allombert on Sat, 21 Nov 2015 19:34:36 +0100|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: Can we remove coeff()?|
On Fri, Nov 20, 2015 at 11:17:38PM +0100, Jeroen Demeyer wrote: > On 2015-11-20 14:23, Bill Allombert wrote: > >You can always do > >#undef coeff > >after including pari.h > > Unfortunately, this isn't so easily done with Cython (which we use > for Sage). There are always hacks around it, but it's precisely > those hacks that I want to get rid of. So I would still prefer just > changing coeff() to some other name, say lcoeff(). PARI includes a lot of macros with short generic names. However C provides various mechanisms to deal with CPP symbols clashes. #undef is one of them Splitting the compilation unit so that PARI headers and NTL headers are not included at the same time is another. If Cython has limitations with respect to the C interface, then you should write a wrapper library around libpari written in C with proper header file, and use that with Cython. (this can be as simple as parisage.h #include <pari/pari.h> #undef coeff ) This would allow you to solve a lot of problems easily, including some older problems you reported. In particular that will give you a canonical location to put extra PARI functions you need but that are not available in libpari, without having to rewrite them in Cython or patching PARI. Cheers, Bill.