[Pyrex] Once more, what's wrong here

Paul Prescod paul at prescod.net
Sun Jan 18 07:58:39 CET 2004


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.

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





More information about the Pyrex mailing list