[Cython] Question about providing functions to existing C code
Stefan Behnel
stefan_ml at behnel.de
Fri Apr 18 17:37:00 CEST 2008
Johannes Wienke wrote:
> Am 04/18/2008 04:53 PM schrieb Stefan Behnel:
>> Johannes Wienke wrote:
>>> void plug_observ_data (plugDefinition *plug, const char *ident);
>>>
>>> This is one example. My problem here is that Cython doesn't know
>>> anything about const. So I can't implement this function appropriately.
>>> Is there any way to solve this problem?
>> You might get away with something like
>>
>> ctypedef constcharptr char* "const char*"
>
> Too bad, doesn't work. In this version even cython doesn't compile. What
> works is:
>
> ctypedef char* constcharptr "const char*"
>
> But that generates obviously wrong C code:
>
> typedef char *const char*;
Hmmm, too bad.
I found this regarding this topic:
http://lists.copyleft.no/pipermail/pyrex/2007-September/002661.html
Hope that helps.
Stefan
More information about the Cython-dev
mailing list