In C extension .pyd, sizeof INT64 = 4?

Allen Allen.Chenal at gmail.com
Tue Jun 12 13:39:43 CEST 2007


On 6 12 ,   6 03 , Allen <Allen.Che... at gmail.com> wrote:
> My C extension works wrong, and debug it, found that sizeof (INT64) =
> 4, not 8.
> I compile on Windows XP platform.
> Please tell me how to fix it to support INT64?
> Thanks.

I find it is strange. In an exe win32 console project, sizeof(INT64) =
8.

My code is just like this:

/* my.h header file */

#ifdef __cplusplus
extern "C" {
#endif

static PyObject* method(PyObject* self, PyObject *args);

#idef __cplusplus
}
#endif

/* my.cpp source file */
PyObject* method(PyObject* self, PyObject *args)
{
   INT64 nValue; /* LINE_HERE */
   INT32 nRet;
   nRet = DoSomeCOperations(nValue);
   return PyBuildValue("i", nRet);
}

If I changed INT64 nValue to be static INT64 nValue at LINE_HERE, it
is ok.
Why?





More information about the Python-list mailing list