On 21 July 2010 12:42, Robert Bradshaw <
robertwb <at> math.washington.edu> wrote:
> On Wed, Jul 21, 2010 at 6:55 AM, Mike Axiak <
mcaxiak <at> gmail.com> wrote:
>> Hi Lionel,
>>
>> Did you ever figure this out? I'm having this exact problem right now
>> in my code.
>>
>> Mike
>>
>> On Wed, May 19, 2010 at 7:08 AM, Lionel Data <
lionel.data <at> gmail.com> wrote:
>>> Hi,
>>>
>>> I've been playing with Cython for a while now, and managed to avoid this
>>> situation a few times, but it seems I'm stuck with it now.
>>>
>>> I have a decl.pxd file stating this:
>>> cdef extern from "myFile.h" namespace "myNamespace":
>>> ctypedef enum myEnum:
>>> VALUE1
>>> VALUE2
>>> VALUE3
>>>
>>> This, as you would imagine, is itself matching a C++ equivalent being
>>> obviously:
>>> namespace myNamespace {
>>> enum myEnum {
>>> VALUE1,
>>> VALUE2,
>>> VALUE3
>>> }
>>> }
>>>
>>> However, it seems I can't correctly reach those values within Cython code. I
>>> tried several syntax tricks, but nothing did the job.
>>>
>>> For instance, I have a cython file called code.pyx, in which I write:
>>> cimport decl
>>>
>>> pyVALUE1 = decl.VALUE1 # Generates C++ code stating "VALUE1" instead of
>>> "myNamespace::VALUE1" which of course results in g++ error
>>> pyVALUE2 = decl.myEnum.VALUE1 # Doesn't even translates to C++ (not
>>> surprising)
>>> pyVALUE3 = decl.myNamespace.VALUE2 # Same as above
>>>
>>> I couldn't find an answer on both
http://wiki.cython.org/WrappingCPlusPlus
>>> and
http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html
>>> Can someone help me on this ?
>
> This looks like a bug. As a workaround, try
>
>>> cdef extern from "myFile.h" namespace "myNamespace":
>>> ctypedef enum myEnum:
>>> VALUE1 "myNamespace::VALUE1"
>