[Pyrex] Once more, what's wrong here

Robin Becker robin at reportlab.com
Sun Jan 18 12:17:28 CET 2004


In article <400A2E9F.5060902 at prescod.net>, Paul Prescod
<paul at prescod.net> writes
>Here is my diganosis of your problem and its workaround. (I can generate 
>a patch if Greg asks me to). The gist is that GCC likes empty structures 
> and Visual C++ does not.
>
well done! After adding the dummy I now get only warnings (I'm using
your pyrex code).

_tex_wrap.c
_tex_wrap.c(91) : warning C4102: '__pyx_L1' : unreferenced label
_tex_wrap.c(271) : warning C4101: 'e' : unreferenced local variable
_tex_wrap.c(424) : warning C4101: 'e' : unreferenced local variable
_tex_wrap.c(570) : warning C4101: 'e' : unreferenced local variable


>http://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html
>
>Pyrex generates empty vtable structures for extension types with no 
>methods. The workaround is to define at least a no-op cdef method for 
>even types with no behaviour.
>
>cdef class _Box:
>    cdef readonly int penalty, flagged, is_glue, is_penalty, is_box
>    cdef char* character
>    cdef double width, stretch, shrink
>    cdef blah(self): pass
>
>(Hopefully)That should hold you over until Pyrex is fixed to follow the 
>Ansi C spec closer in this regard. I diagnosed this without access to 
>Visual Studio so I can't test your example out to see if any other 
>issues arise.
>
>You said something about an extraneous variable "e" but I'm hoping that 
>is fixed by the patch I gave you before because I don't see anything 
>about a variable "e" in the most recent error log you gave me:
>
>building '_tex_wrap' extension
>C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe /c /nologo /Ox
>/MD /W3 /GX /DNDEBUG -IC:\Python\include -IC:\Py
>thon\PC /Tc_tex_wrap.c /Fobuild\temp.win32-2.3\Release\_tex_wrap.obj
>_tex_wrap.c
>_tex_wrap.c(49) : error C2059: syntax error : '}'
>_tex_wrap.c(59) : error C2079: '__pyx_base' uses undefined struct
>'__pyx_vtabstruct_9_tex_wrap__Box'
>_tex_wrap.c(71) : error C2079: '__pyx_base' uses undefined struct
>'__pyx_vtabstruct_9_tex_wrap__Box'
>_tex_wrap.c(240) : error C2079: '__pyx_vtable_9_tex_wrap__Box' uses
>undefined struct '__pyx_vtabstruct_9_tex_wrap__Box'
>_tex_wrap.c(693) : warning C4133: '=' : incompatible types - from 'int
>*' to 'struct __pyx_vtabstruct_9_tex_wrap__Box *'
>
>_tex_wrap.c(699) : error C2115: '=' : incompatible types
>_tex_wrap.c(706) : error C2115: '=' : incompatible types
>
> Paul Prescod
>
>

-- 
Robin Becker




More information about the Pyrex mailing list