compiling extension errors

Pete Shinners pshinners at mediaone.net
Sat May 13 15:23:44 EDT 2000


i'm getting in touch with the author of the module, but i'm trying
to compile with extension under win32, with visc6.

the code in the header file looks like this.

static PyTypeObject CD_Type =
{
    PyObject_HEAD_INIT(&PyType_Type)
    0,
    "CD",
    sizeof(CD_Object),
    0,
    sdl_cd_dealloc,
    0,
    sdl_cd_getattr,
    0,
    0,
    0,
    0,
    &sdl_cd_as_sequence,
    0
};

ok, so this is simple creating a new structure to represent
a new type object (right?). When compiling i'm getting this
error.

"error C2099: initializer is not a constant"
this is happening on the line with PyObject_HEAD_INIT(...)

i've been trying to track this one back. it looks like the
HEAD_INIT just substitutes in a couple int constants
(depending on debug settings) and the constant passed in
as one of the arguments.

the problem seems to be "&PyType_Type" is not a constant.
this is defined as
extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */



is this a windows issue? the fact that the variable lies in a
shared library is making it non-constant? does this mean i must
compile this extension directly into the interpreter? i'd really
like to keep it as shared extension, but i'm not sure what
changes can be made.







More information about the Python-list mailing list