In C extension .pyd, sizeof INT64 = 4?

Allen Allen.Chenal at gmail.com
Tue Jun 12 21:44:26 EDT 2007


On 6 13 ,   9 00 , Allen <pruyu.c... at gmail.com> wrote:
> On 6 13 ,   4 06 , "Martin v. Lo"wis" <mar... at v.loewis.de> wrote:
>
> > Allen schrieb:
>
> > > 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?
>
> > What *is* INT64? It's not a builtin type of standard C, it isn't
> > defined by Microsoft C, and it isn't predefined by Python.
>
> > So it must be something that you have defined, and apparently
> > incorrectly. How did you define it?
>
> > Regards,
> > Martin
>
> Thanks for your reply.
>
> I defined in this way:
>
> #ifndef WIN32
> typedef long long       INT64;
> #else
> typedef __int64 INT64;
> #endif
>
> I feel it strange that when I use INT64 as local variable, it will run
> error.
> When I change the local variable to be static or global, it will be
> ok.

I feel very very sorry.
It is my fault.
I used INT64 and initialize its value from PyArg_ParseTuple.
The code is PyArg_ParseTuple(args, "l", &nValue).
It should be PyArg_ParseTuple(args, "L", &nValue).

Thanks all of you.

Regars,
Allen Chen




More information about the Python-list mailing list