[Cython] C data type and a C function() sharing the same name

Marin Atanasov Nikolov dnaeon at gmail.com
Sat Jun 1 16:35:52 CEST 2013


Thanks, Nikita!

I've been looking at the Cython documentation, but was not able to find it
previously, thanks!

I'm still waiting for my previous posts to show up in the
cython-users at mailing list (although I am subscribed there), but they
don't seem to show
up.

Thanks for your help!

Best regards,
Marin

//offtopic
Why does it take so long for a post to be approved/published on
cython-users@ ?



On Sat, Jun 1, 2013 at 5:12 PM, Nikita Nemkin <nikita at nemkin.ru> wrote:

> On Sat, 01 Jun 2013 19:29:17 +0600, Marin Atanasov Nikolov <
> dnaeon at gmail.com> wrote:
>
>  Hello,
>>
>> Working on creating Cython wrappers for a C library I came across a
>> strange
>> problem.
>>
>> I have in the C library a struct like this:
>>
>>  struct my_jobs;
>>
>> I also have this function, which returns the next job in the queue:
>>
>>  int my_jobs(struct my_jobs *jobs);
>>
>> Translating this into Cython and putting this in the .pxd file it looks
>> like this:
>>
>>   cdef struct my_jobs
>>   int my_jobs(my_jobs *jobs)
>>
>> During build I'm having issues because it seems that the function
>> my_jobs()
>> is translated in a way that it should return a "int struct my_jobs".
>>
>> The real problem I see is that I cannot have a data type and a function
>> sharing the same name.
>>
>> How can I overcome this issue? Suppose that I wrote the C API I could
>> change that, but how would you really  solve this if you cannot touch
>> what's in upstream?
>>
>> Any ways to solve this?
>>
>
> This question would be more appropriate on the cython-users mailing list.
>
> Use renaming:
> http://docs.cython.org/src/**userguide/external_C_code.**
> html#resolving-naming-**conflicts-c-name-**specifications<http://docs.cython.org/src/userguide/external_C_code.html#resolving-naming-conflicts-c-name-specifications>
>
> For example, rename the function:
>
>     int my_jobs_func "my_jobs" (my_jobs *jobs)
>
> or the struct:
>
>     cdef struct my_jobs_t "my_jobs"
>
> or both.
>
> Best regards,
> Nikita Nemkin
> ______________________________**_________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/**mailman/listinfo/cython-devel<http://mail.python.org/mailman/listinfo/cython-devel>
>



-- 
Marin Atanasov Nikolov

dnaeon AT gmail DOT com
http://www.unix-heaven.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20130601/54984821/attachment.html>


More information about the cython-devel mailing list