[Pyrex] A simple question

Robert Bradshaw robertwb at math.washington.edu
Tue Apr 17 17:28:41 UTC 2007


I believe you could even declare their type, and pyrex will do the  
right thing:

cdef extern from "someheader.h":
     int const1
     int const2
     ...

On Apr 17, 2007, at 9:10 AM, Lenard Lindstrom wrote:

> Alain Pointdexter wrote:
>> Hi,
>>
>> I am confronted to a seemingly simple problem but i cannot find  a  
>> straightforward solution to it.
>>
>> How do you access the constants defined in a .h header file, for  
>> example as defined in an anonynous enum.
>> cdef enum:
>>     const1=1
>>     const2=3
>>     ....
>>
>
> I would assume you put an anonymous enum in a cdef extern:
>
> cdef extern from "someheader.h":
>     enum:
>         const1
>         const2
>         ....
>
> Leave out the assignments as the C compiler use the declaration in  
> the C
> header file.
>
> -- 
> Lenard Lindstrom
> <len-l at telus.net>
>
>
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex




More information about the Pyrex mailing list