[Pyrex] const in function type signature

Robert Bradshaw robertwb at math.washington.edu
Mon Dec 29 22:18:11 CET 2008


On Dec 25, 2008, at 3:09 AM, Dominic Sacré wrote:

> Hi,
>
> I'm using Pyrex to wrap a C library that uses callbacks. Some of the
> parameters to the callback functions are const, e.g.
> void(*callback)(int num, const char *msg, const char *where)
>
> Pyrex doesn't allow const, so i have to write this as
> void(*callback)(int num, char *msg, char *where)
>
> This works, as long as the function doesn't actually try to modify its
> arguments, but passing the function pointer to the library produces
> warnings like:
> passing argument 2 of ‘lo_server_new’ from incompatible pointer type
>
> Is there some way to get rid of these warnings? Basically, just  
> allowing the
> use of const in the Pyrex source, and literally placing it in the  
> generated
> C code would suffice...

Yes, see http://wiki.cython.org/FAQ#head- 
af019db12f683abe6bc226926e8a2a92425b8e57

- Robert


More information about the Pyrex mailing list